summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/aarch64/sve_struct_vect_19_run.c
blob: 94593cef684431ab327734cad394e3ada7da7e7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* { dg-do run { target aarch64_sve_hw } } */
/* { dg-options "-O2 -ftree-vectorize -march=armv8-a+sve" } */

#include "sve_struct_vect_19.c"

volatile int x;

#define N 1000

#undef TEST_LOOP
#define TEST_LOOP(NAME, TYPE)				\
  {							\
    TYPE out[N];					\
    TYPE in[N * 2];					\
    int counts[] = { 0, 1, N - 1 };			\
    for (int j = 0; j < 3; ++j)				\
      {							\
	int count = counts[j];				\
	for (int i = 0; i < N; ++i)			\
	  out[i] = i * 7 / 2;				\
	for (int i = 0; i < N * 2; ++i)			\
	  in[i] = i * 9 / 2;				\
	NAME (out, in, count);				\
	for (int i = 0; i < N; ++i)			\
	  {						\
	    TYPE expected = i * 7 / 2;			\
	    if (i < count)				\
	      expected += in[i * 2];			\
	    if (out[i] != expected)			\
	      __builtin_abort ();			\
	    x += 1;					\
	  }						\
      }							\
  }

int
main (void)
{
  TEST (test);
  return 0;
}