]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.target/aarch64/sve/sel_3.c
2019-08-22 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
[thirdparty/gcc.git] / gcc / testsuite / gcc.target / aarch64 / sve / sel_3.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 _Float16 vnx8hf __attribute__((vector_size (32)));
10 typedef float vnx4sf __attribute__((vector_size (32)));
11
12 /* Predicate vector: 1 0 0 0 0 0 0 0 ... */
13
14 #define MASK_32 { 0, 33, 34, 35, 36, 37, 38, 39, \
15 8, 41, 42, 43, 44, 45, 46, 47, \
16 16, 49, 50, 51, 52, 53, 54, 55, \
17 24, 57, 58, 59, 60, 61, 62, 63 }
18
19 /* Predicate vector: 1 0 0 0 ... */
20
21 #define MASK_16 { 0, 17, 18, 19, 4, 21, 22, 23, \
22 8, 25, 26, 27, 12, 29, 30, 31 }
23
24 /* Predicate vector: 1 0 ... */
25
26 #define MASK_8 { 0, 9, 2, 11, 4, 13, 6, 15 }
27
28 #define INDEX_32 vnx16qi
29 #define INDEX_16 vnx8hi
30 #define INDEX_8 vnx4si
31
32 #define PERMUTE(type, nunits) \
33 type permute_##type (type x, type y) \
34 { \
35 return __builtin_shuffle (x, y, (INDEX_##nunits) MASK_##nunits); \
36 }
37
38 PERMUTE(vnx16qi, 32)
39 PERMUTE(vnx8hi, 16)
40 PERMUTE(vnx4si, 8)
41 PERMUTE(vnx8hf, 16)
42 PERMUTE(vnx4sf, 8)
43
44 /* { dg-final { scan-assembler-not {\ttbl\t} } } */
45
46 /* { dg-final { scan-assembler-times {\tsel\tz[0-9]+\.b, p[0-9]+, z[0-9]+\.b, z[0-9]+\.b\n} 1 } } */
47 /* { dg-final { scan-assembler-times {\tsel\tz[0-9]+\.h, p[0-9]+, z[0-9]+\.h, z[0-9]+\.h\n} 2 } } */
48 /* { dg-final { scan-assembler-times {\tsel\tz[0-9]+\.s, p[0-9]+, z[0-9]+\.s, z[0-9]+\.s\n} 2 } } */
49
50 /* { dg-final { scan-assembler-times {\tptrue\tp[0-9]+\.d, vl4\n} 5 } } */