Add support for conditional reductions using SVE CLASTB
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / sve / slp_6_run.c
blobf1aeb5cd305b065d4b86dfe247ecae97308c194b
1 /* { dg-do run { target aarch64_sve_hw } } */
2 /* { dg-options "-O2 -ftree-vectorize -ffast-math" } */
4 #include "slp_6.c"
6 #define N (77 * 3)
8 #define HARNESS(TYPE) \
9 { \
10 TYPE a[N], b[3] = { 40, 22, 75 }; \
11 for (unsigned int i = 0; i < N; ++i) \
12 { \
13 a[i] = i * 2 + i % 5; \
14 asm volatile ("" ::: "memory"); \
15 } \
16 vec_slp_##TYPE (a, b, N / 3); \
17 TYPE x0 = 40; \
18 TYPE x1 = 22; \
19 TYPE x2 = 75; \
20 for (unsigned int i = 0; i < N; i += 3) \
21 { \
22 x0 += a[i]; \
23 x1 += a[i + 1]; \
24 x2 += a[i + 2]; \
25 asm volatile ("" ::: "memory"); \
26 } \
27 /* _Float16 isn't precise enough for this. */ \
28 if ((TYPE) 0x1000 + 1 != (TYPE) 0x1000 \
29 && (x0 != b[0] || x1 != b[1] || x2 != b[2])) \
30 __builtin_abort (); \
33 int __attribute__ ((optimize (1)))
34 main (void)
36 TEST_ALL (HARNESS)