Debian Codegraph @

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

raw
1 /* { dg-do assemble { target aarch64_asm_sve_ok } } */
2 /* { dg-options "-O2 -ftree-vectorize -ffast-math --save-temps" } */
3
4 #include <stdint.h>
5
6 #ifndef INDEX32
7 #define INDEX32 int32_t
8 #define INDEX64 int64_t
9 #endif
10
11 #define TEST_LOOP(DATA_TYPE, CMP_TYPE, BITS) \
12 void \
13 f_##DATA_TYPE##_##CMP_TYPE \
14 (DATA_TYPE *restrict dest, DATA_TYPE *restrict src, \
15 CMP_TYPE *restrict cmp1, CMP_TYPE *restrict cmp2, \
16 INDEX##BITS *restrict indices, int n) \
17 { \
18 for (int i = 0; i < n; ++i) \
19 if (cmp1[i] == cmp2[i]) \
20 dest[indices[i]] = src[i] + 1; \
21 }
22
23 #define TEST32(T, DATA_TYPE) \
24 T (DATA_TYPE, int32_t, 32) \
25 T (DATA_TYPE, uint32_t, 32) \
26 T (DATA_TYPE, float, 32)
27
28 #define TEST64(T, DATA_TYPE) \
29 T (DATA_TYPE, int64_t, 64) \
30 T (DATA_TYPE, uint64_t, 64) \
31 T (DATA_TYPE, double, 64)
32
33 #define TEST_ALL(T) \
34 TEST32 (T, int32_t) \
35 TEST32 (T, uint32_t) \
36 TEST32 (T, float) \
37 TEST64 (T, int64_t) \
38 TEST64 (T, uint64_t) \
39 TEST64 (T, double)
40
41 TEST_ALL (TEST_LOOP)
42
43 /* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.s, p[0-7]/z, \[x[0-9]+, x[0-9]+, lsl 2\]\n} 36 } } */
44 /* { dg-final { scan-assembler-times {\tcmpeq\tp[0-7]\.s, p[0-7]/z, z[0-9]+\.s, z[0-9]+\.s\n} 6 } } */
45 /* { dg-final { scan-assembler-times {\tfcmeq\tp[0-7]\.s, p[0-7]/z, z[0-9]+\.s, z[0-9]+\.s\n} 3 } } */
46 /* { dg-final { scan-assembler-times {\tst1w\tz[0-9]+\.s, p[0-7], \[x[0-9]+, z[0-9]+\.s, sxtw 2\]\n} 9 } } */
47
48 /* { dg-final { scan-assembler-times {\tld1d\tz[0-9]+\.d, p[0-7]/z, \[x[0-9]+, x[0-9]+, lsl 3\]\n} 36 } } */
49 /* { dg-final { scan-assembler-times {\tcmpeq\tp[0-7]\.d, p[0-7]/z, z[0-9]+\.d, z[0-9]+\.d\n} 6 } } */
50 /* { dg-final { scan-assembler-times {\tfcmeq\tp[0-7]\.d, p[0-7]/z, z[0-9]+\.d, z[0-9]+\.d\n} 3 } } */
51 /* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d, p[0-7], \[x[0-9]+, z[0-9]+\.d, lsl 3\]\n} 9 } } */