]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.target/aarch64/sve/sel_5.c
2019-08-22 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
[thirdparty/gcc.git] / gcc / testsuite / gcc.target / aarch64 / sve / sel_5.c
1 /* { dg-do assemble { target aarch64_asm_sve_ok } } */
2 /* { dg-options "-O2 -msve-vector-bits=256 --save-temps" } */
3
4 #include <stdint.h>
5
6 typedef int8_t vnx16qi __attribute__((vector_size (32)));
7 typedef int16_t vnx8hi __attribute__((vector_size (32)));
8 typedef int32_t vnx4si __attribute__((vector_size (32)));
9 typedef int64_t vnx2di __attribute__((vector_size (32)));
10
11 typedef _Float16 vnx8hf __attribute__((vector_size (32)));
12 typedef float vnx4sf __attribute__((vector_size (32)));
13 typedef double vnx2df __attribute__((vector_size (32)));
14
15 /* Predicate vector: 1 0 0 1 ... */
16
17 #define MASK_32 { 0, 33, 34, 3, 4, 37, 38, 7, 8, 41, 42, 11, 12, 45, 46, \
18 15, 16, 49, 50, 19, 20, 53, 54, 23, 24, 57, 58, 27, 28, \
19 61, 62, 31 }
20
21 #define MASK_16 {0, 17, 18, 3, 4, 21, 22, 7, 8, 25, 26, 11, 12, 29, 30, 15}
22 #define MASK_8 {0, 9, 10, 3, 4, 13, 14, 7}
23 #define MASK_4 {0, 5, 6, 3}
24
25 #define INDEX_32 vnx16qi
26 #define INDEX_16 vnx8hi
27 #define INDEX_8 vnx4si
28 #define INDEX_4 vnx2di
29
30 #define PERMUTE(type, nunits) \
31 type permute_##type (type x, type y) \
32 { \
33 return __builtin_shuffle (x, y, (INDEX_##nunits) MASK_##nunits); \
34 }
35
36 PERMUTE(vnx16qi, 32)
37 PERMUTE(vnx8hi, 16)
38 PERMUTE(vnx4si, 8)
39 PERMUTE(vnx2di, 4)
40
41 PERMUTE(vnx8hf, 16)
42 PERMUTE(vnx4sf, 8)
43 PERMUTE(vnx2df, 4)
44
45 /* { dg-final { scan-assembler-not {\ttbl\t} } } */
46
47 /* { dg-final { scan-assembler-times {\tsel\tz[0-9]+\.b, p[0-9]+, z[0-9]+\.b, z[0-9]+\.b\n} 1 } } */
48 /* { dg-final { scan-assembler-times {\tsel\tz[0-9]+\.h, p[0-9]+, z[0-9]+\.h, z[0-9]+\.h\n} 2 } } */
49 /* { dg-final { scan-assembler-times {\tsel\tz[0-9]+\.s, p[0-9]+, z[0-9]+\.s, z[0-9]+\.s\n} 2 } } */
50 /* { dg-final { scan-assembler-times {\tsel\tz[0-9]+\.d, p[0-9]+, z[0-9]+\.d, z[0-9]+\.d\n} 2 } } */