Add support for conditional reductions using SVE CLASTB
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / sve / slp_10.c
blob6fe9f25096c787da733004266a7b05e4f6001029
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -ftree-vectorize -msve-vector-bits=scalable" } */
4 #include <stdint.h>
6 #define VEC_PERM(TYPE) \
7 void __attribute__ ((noinline, noclone)) \
8 vec_slp_##TYPE (TYPE *restrict a, TYPE *restrict b, int n) \
9 { \
10 for (int i = 0; i < n; ++i) \
11 { \
12 a[i] += 1; \
13 b[i * 4] += 2; \
14 b[i * 4 + 1] += 3; \
15 b[i * 4 + 2] += 4; \
16 b[i * 4 + 3] += 5; \
17 } \
20 #define TEST_ALL(T) \
21 T (int8_t) \
22 T (uint8_t) \
23 T (int16_t) \
24 T (uint16_t) \
25 T (int32_t) \
26 T (uint32_t) \
27 T (int64_t) \
28 T (uint64_t) \
29 T (float) \
30 T (double)
32 TEST_ALL (VEC_PERM)
34 /* The loop should be fully-masked. */
35 /* { dg-final { scan-assembler-times {\tld1b\t} 10 } } */
36 /* { dg-final { scan-assembler-times {\tst1b\t} 10 } } */
37 /* { dg-final { scan-assembler-times {\tld1h\t} 10 } } */
38 /* { dg-final { scan-assembler-times {\tst1h\t} 10 } } */
39 /* { dg-final { scan-assembler-times {\tld1w\t} 15 } } */
40 /* { dg-final { scan-assembler-times {\tst1w\t} 15 } } */
41 /* { dg-final { scan-assembler-times {\tld1d\t} 15 } } */
42 /* { dg-final { scan-assembler-times {\tst1d\t} 15 } } */
43 /* { dg-final { scan-assembler-not {\tldr} } } */
44 /* { dg-final { scan-assembler-not {\tstr} } } */
46 /* We should use WHILEs for all accesses. */
47 /* { dg-final { scan-assembler-times {\twhilelo\tp[0-7]\.b} 20 } } */
48 /* { dg-final { scan-assembler-times {\twhilelo\tp[0-7]\.h} 20 } } */
49 /* { dg-final { scan-assembler-times {\twhilelo\tp[0-7]\.s} 30 } } */
50 /* { dg-final { scan-assembler-times {\twhilelo\tp[0-7]\.d} 30 } } */
52 /* 6 for the 8-bit types and 2 for the 16-bit types. */
53 /* { dg-final { scan-assembler-times {\tuqdecb\t} 8 } } */
54 /* 4 for the 16-bit types and 3 for the 32-bit types. */
55 /* { dg-final { scan-assembler-times {\tuqdech\t} 7 } } */
56 /* 6 for the 32-bit types and 3 for the 64-bit types. */
57 /* { dg-final { scan-assembler-times {\tuqdecw\t} 9 } } */
58 /* { dg-final { scan-assembler-times {\tuqdecd\t} 6 } } */