summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/aarch64/sve_cond_arith_4_run.c
blob: e9b5b938d1f3c63da35053535c1971cdd710f68d (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
/* { dg-do run { target aarch64_sve_hw } } */
/* { dg-options "-O2 -ftree-vectorize -march=armv8-a+sve" } */

#include "sve_cond_arith_4.c"

#define N 98

#undef TEST
#define TEST(DATA_TYPE, OTHER_TYPE, NAME, OP)				\
  {									\
    DATA_TYPE x[N], y[N], pred[N], z[2] = { 5, 7 };			\
    OTHER_TYPE foo[N];							\
    for (int i = 0; i < N; ++i)						\
      {									\
	y[i] = i * i;							\
	pred[i] = i % 3;						\
	foo[i] = i * 5;							\
      }									\
    test_##DATA_TYPE##_##OTHER_TYPE##_##NAME (x, y, z[0], z[1],		\
					      pred, foo, N);		\
    for (int i = 0; i < N; ++i)						\
      {									\
	DATA_TYPE expected = i % 3 != 1 ? y[i] OP z[i & 1] : y[i];	\
	if (x[i] != expected)						\
	  __builtin_abort ();						\
	asm volatile ("" ::: "memory");					\
      }									\
  }

int
main (void)
{
  TEST_ALL
  return 0;
}