Use conditional internal functions in if-conversion
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / sve / mask_gather_load_7.c
blobcd2661ef3a5da863661f90a0eac62bea876d789c
1 /* { dg-do assemble { target aarch64_asm_sve_ok } } */
2 /* { dg-options "-O2 -ftree-vectorize -ffast-math --save-temps" } */
4 #include <stdint.h>
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]]; \
17 #define TEST32(T, DATA_TYPE) \
18 T (DATA_TYPE, int16_t, int32_t) \
19 T (DATA_TYPE, uint16_t, int32_t) \
20 T (DATA_TYPE, _Float16, int32_t) \
21 T (DATA_TYPE, int16_t, uint32_t) \
22 T (DATA_TYPE, uint16_t, uint32_t) \
23 T (DATA_TYPE, _Float16, uint32_t)
25 #define TEST64(T, DATA_TYPE) \
26 T (DATA_TYPE, int32_t, int64_t) \
27 T (DATA_TYPE, uint32_t, int64_t) \
28 T (DATA_TYPE, float, int64_t) \
29 T (DATA_TYPE, int32_t, uint64_t) \
30 T (DATA_TYPE, uint32_t, uint64_t) \
31 T (DATA_TYPE, float, uint64_t)
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)
41 TEST_ALL (TEST_LOOP)
43 /* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.h, p[0-7]/z, \[x[0-9]+, x[0-9]+, lsl 1\]\n} 36 } } */
44 /* { dg-final { scan-assembler-times {\tcmpeq\tp[0-7]\.h, p[0-7]/z, z[0-9]+\.h, z[0-9]+\.h\n} 12 } } */
45 /* { dg-final { scan-assembler-times {\tfcmeq\tp[0-7]\.h, p[0-7]/z, z[0-9]+\.h, z[0-9]+\.h\n} 6 } } */
46 /* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.s, p[0-7]/z, \[x[0-9]+, z[0-9]+\.s, sxtw 2\]\n} 18 } } */
47 /* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.s, p[0-7]/z, \[x[0-9]+, z[0-9]+\.s, uxtw 2\]\n} 18 } } */
49 /* Also used for the TEST32 indices. */
50 /* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.s, p[0-7]/z, \[x[0-9]+, x[0-9]+, lsl 2\]\n} 72 } } */
51 /* { dg-final { scan-assembler-times {\tcmpeq\tp[0-7]\.s, p[0-7]/z, z[0-9]+\.s, z[0-9]+\.s\n} 12 } } */
52 /* { dg-final { scan-assembler-times {\tfcmeq\tp[0-7]\.s, p[0-7]/z, z[0-9]+\.s, z[0-9]+\.s\n} 6 } } */
53 /* { dg-final { scan-assembler-times {\tld1d\tz[0-9]+\.d, p[0-7]/z, \[x[0-9]+, z[0-9]+\.d, lsl 3\]\n} 36 } } */