Debian Codegraph @

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

raw
1 /* { dg-do assemble { target aarch64_variant_pcs } } */
2 /* { dg-options "-O2 -msve-vector-bits=256 --save-temps" } */
3 /* { dg-final { check-function-bodies "**" "" } } */
4
5 #include <stdint.h>
6
7 typedef int8_t vnx16qi __attribute__((vector_size (32)));
8 typedef int16_t vnx8hi __attribute__((vector_size (32)));
9
10 typedef _Float16 vnx8hf __attribute__((vector_size (32)));
11
12 /* Predicate vector: 1 0 0 0 ... */
13
14 #define MASK_32 { 0, 33, 34, 35, 4, 37, 38, 39, 8, 41, 42, 43, 12, \
15 45, 46, 47, 16, 49, 50, 51, 20, 53, 54, 55, 24, \
16 57, 58, 59, 28, 61, 62, 63 }
17
18 /* Predicate vector: 1 0 1 0 ... */
19
20 #define MASK_16 {0, 17, 2, 19, 4, 21, 6, 23, 8, 25, 10, 27, 12, 29, 14, 31}
21
22 /*
23 ** permute_vnx16qi:
24 ** ptrue (p[0-7])\.s, vl8
25 ** sel z0\.b, \1, z0\.b, z1\.b
26 ** ret
27 */
28 __SVInt8_t
29 permute_vnx16qi (__SVInt8_t x, __SVInt8_t y)
30 {
31 return __builtin_shuffle ((vnx16qi) x, (vnx16qi) y, (vnx16qi) MASK_32);
32 }
33
34 /*
35 ** permute_vnx8hi:
36 ** ptrue (p[0-7])\.s, vl8
37 ** sel z0\.h, \1, z0\.h, z1\.h
38 ** ret
39 */
40 __SVInt16_t
41 permute_vnx8hi (__SVInt16_t x, __SVInt16_t y)
42 {
43 return __builtin_shuffle ((vnx8hi) x, (vnx8hi) y, (vnx8hi) MASK_16);
44 }
45
46 /*
47 ** permute_vnx8hf:
48 ** ptrue (p[0-7])\.s, vl8
49 ** sel z0\.h, \1, z0\.h, z1\.h
50 ** ret
51 */
52 __SVFloat16_t
53 permute_vnx8hf (__SVFloat16_t x, __SVFloat16_t y)
54 {
55 return (__SVFloat16_t) __builtin_shuffle ((vnx8hf) x, (vnx8hf) y,
56 (vnx8hi) MASK_16);
57 }