Debian Codegraph @

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

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