Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/sve/maxmin_1_run.c

raw
1 /* { dg-do run { target { aarch64_sve_hw } } } */
2 /* { dg-options "-O2 -ftree-vectorize -ffast-math" } */
3
4 #include "maxmin_1.c"
5
6 #define TEST_LOOP(TYPE, NAME, CMP_OP) \
7 { \
8 TYPE a[NUM_ELEMS (TYPE)]; \
9 TYPE b[NUM_ELEMS (TYPE)]; \
10 TYPE r[NUM_ELEMS (TYPE)]; \
11 for (int i = 0; i < NUM_ELEMS (TYPE); i++) \
12 { \
13 a[i] = ((i * 2) % 3) * (i & 1 ? 1 : -1); \
14 b[i] = (1 + (i % 4)) * (i & 1 ? -1 : 1); \
15 asm volatile ("" ::: "memory"); \
16 } \
17 fun_##NAME##_##TYPE (r, a, b); \
18 for (int i = 0; i < NUM_ELEMS (TYPE); i++) \
19 if (r[i] != (a[i] CMP_OP b[i] ? a[i] : b[i])) \
20 __builtin_abort (); \
21 }
22
23 int main ()
24 {
25 TEST_ALL (TEST_LOOP)
26 return 0;
27 }