1 /* { dg-do compile } */
2 /* { dg-options "-O2 -ftree-vectorize -ffast-math" } */
6 #define NUM_ELEMS(TYPE) (32 / sizeof (TYPE))
8 #define REDUC_PTR(DSTTYPE, SRCTYPE) \
9 void reduc_ptr_##DSTTYPE##_##SRCTYPE (DSTTYPE *restrict sum, \
10 SRCTYPE *restrict array, \
14 for (int i = 0; i < count; ++i) \
18 REDUC_PTR (int8_t, int8_t)
19 REDUC_PTR (int16_t, int16_t)
21 REDUC_PTR (int32_t, int32_t)
22 REDUC_PTR (int64_t, int64_t)
24 REDUC_PTR (_Float16
, _Float16
)
25 REDUC_PTR (float, float)
26 REDUC_PTR (double, double)
28 /* Widening reductions. */
29 REDUC_PTR (int32_t, int8_t)
30 REDUC_PTR (int32_t, int16_t)
32 REDUC_PTR (int64_t, int8_t)
33 REDUC_PTR (int64_t, int16_t)
34 REDUC_PTR (int64_t, int32_t)
36 REDUC_PTR (float, _Float16
)
37 REDUC_PTR (double, float)
39 /* Float<>Int conversions */
40 REDUC_PTR (_Float16
, int16_t)
41 REDUC_PTR (float, int32_t)
42 REDUC_PTR (double, int64_t)
44 REDUC_PTR (int16_t, _Float16
)
45 REDUC_PTR (int32_t, float)
46 REDUC_PTR (int64_t, double)
48 /* { dg-final { scan-assembler-times {\tuaddv\td[0-9]+, p[0-7], z[0-9]+\.s\n} 3 } } */
49 /* { dg-final { scan-assembler-times {\tuaddv\td[0-9]+, p[0-7], z[0-9]+\.d\n} 4 } } */
50 /* { dg-final { scan-assembler-times {\tfaddv\th[0-9]+, p[0-7], z[0-9]+\.h\n} 2 } } */
51 /* { dg-final { scan-assembler-times {\tfaddv\ts[0-9]+, p[0-7], z[0-9]+\.s\n} 3 } } */
52 /* { dg-final { scan-assembler-times {\tfaddv\td[0-9]+, p[0-7], z[0-9]+\.d\n} 3 } } */