Add support for conditional reductions using SVE CLASTB
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / sve / slp_5_run.c
blob043c9b83edac0d01e1b8c0de4ff562acc40dcb05
1 /* { dg-do run { target aarch64_sve_hw } } */
2 /* { dg-options "-O2 -ftree-vectorize -ffast-math" } */
4 #include "slp_5.c"
6 #define N (141 * 2)
8 #define HARNESS(TYPE) \
9 { \
10 TYPE a[N], b[2] = { 40, 22 }; \
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 / 2); \
17 TYPE x0 = 40; \
18 TYPE x1 = 22; \
19 for (unsigned int i = 0; i < N; i += 2) \
20 { \
21 x0 += a[i]; \
22 x1 += a[i + 1]; \
23 asm volatile ("" ::: "memory"); \
24 } \
25 /* _Float16 isn't precise enough for this. */ \
26 if ((TYPE) 0x1000 + 1 != (TYPE) 0x1000 \
27 && (x0 != b[0] || x1 != b[1])) \
28 __builtin_abort (); \
31 int __attribute__ ((optimize (1)))
32 main (void)
34 TEST_ALL (HARNESS)