Debian Codegraph @

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

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -ftree-vectorize" } */
3
4 #define NUM_ELEMS(TYPE) ((int) (5 * (256 / sizeof (TYPE)) + 3))
5
6 #define DEF_REDUC_PLUS(TYPE) \
7 void __attribute__ ((noinline, noclone)) \
8 reduc_plus_##TYPE (TYPE (*restrict a)[NUM_ELEMS (TYPE)], \
9 TYPE *restrict r, int n) \
10 { \
11 for (int i = 0; i < n; i++) \
12 { \
13 r[i] = 0; \
14 for (int j = 0; j < NUM_ELEMS (TYPE); j++) \
15 r[i] += a[i][j]; \
16 } \
17 }
18
19 #define TEST_ALL(T) \
20 T (_Float16) \
21 T (float) \
22 T (double)
23
24 TEST_ALL (DEF_REDUC_PLUS)
25
26 /* { dg-final { scan-assembler-times {\tfadda\th[0-9]+, p[0-7], h[0-9]+, z[0-9]+\.h} 1 } } */
27 /* { dg-final { scan-assembler-times {\tfadda\ts[0-9]+, p[0-7], s[0-9]+, z[0-9]+\.s} 1 } } */
28 /* { dg-final { scan-assembler-times {\tfadda\td[0-9]+, p[0-7], d[0-9]+, z[0-9]+\.d} 1 } } */