Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/merge-5.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-march=rv64gcv_zvfhmin -mabi=lp64d -O3 -mrvv-vector-bits=zvl" } */
3
4 #include <stdint-gcc.h>
5
6 typedef int8_t vnx8qi __attribute__((vector_size (8)));
7 typedef int16_t vnx4hi __attribute__((vector_size (8)));
8 typedef int32_t vnx2si __attribute__((vector_size (8)));
9 typedef uint8_t vnx8uqi __attribute__((vector_size (8)));
10 typedef uint16_t vnx4uhi __attribute__((vector_size (8)));
11 typedef uint32_t vnx2usi __attribute__((vector_size (8)));
12
13 typedef _Float16 vnx4hf __attribute__((vector_size (8)));
14 typedef float vnx2sf __attribute__((vector_size (8)));
15
16 #define MASK_8 0, 9, 2, 11, 4, 13, 6, 15
17 #define MASK_4 0, 5, 2, 7
18 #define MASK_2 0, 3
19
20 void __attribute__ ((noipa))
21 merge0 (vnx8qi x, vnx8qi y, vnx8qi *out)
22 {
23 vnx8qi v = __builtin_shufflevector ((vnx8qi) x, (vnx8qi) y, MASK_8);
24 *(vnx8qi *)out = v;
25 }
26
27 void __attribute__ ((noipa))
28 merge1 (vnx8uqi x, vnx8uqi y, vnx8uqi *out)
29 {
30 vnx8uqi v = __builtin_shufflevector ((vnx8uqi) x, (vnx8uqi) y, MASK_8);
31 *(vnx8uqi *)out = v;
32 }
33
34 void __attribute__ ((noipa))
35 merge2 (vnx4hi x, vnx4hi y, vnx4hi *out)
36 {
37 vnx4hi v = __builtin_shufflevector ((vnx4hi) x, (vnx4hi) y, MASK_4);
38 *(vnx4hi *)out = v;
39 }
40
41 void __attribute__ ((noipa))
42 merge3 (vnx4uhi x, vnx4uhi y, vnx4uhi *out)
43 {
44 vnx4uhi v = __builtin_shufflevector ((vnx4uhi) x, (vnx4uhi) y, MASK_4);
45 *(vnx4uhi *)out = v;
46 }
47
48 void __attribute__ ((noipa))
49 merge4 (vnx2si x, vnx2si y, vnx2si *out)
50 {
51 vnx2si v = __builtin_shufflevector ((vnx2si) x, (vnx2si) y, MASK_2);
52 *(vnx2si *)out = v;
53 }
54
55 void __attribute__ ((noipa))
56 merge5 (vnx2usi x, vnx2usi y, vnx2usi *out)
57 {
58 vnx2usi v = __builtin_shufflevector ((vnx2usi) x, (vnx2usi) y, MASK_2);
59 *(vnx2usi *)out = v;
60 }
61
62 void __attribute__ ((noipa))
63 merge6 (vnx4hf x, vnx4hf y, vnx4hf *out)
64 {
65 vnx4hf v = __builtin_shufflevector ((vnx4hf) x, (vnx4hf) y, MASK_4);
66 *(vnx4hf *)out = v;
67 }
68
69 void __attribute__ ((noipa))
70 merge7 (vnx2sf x, vnx2sf y, vnx2sf *out)
71 {
72 vnx2sf v = __builtin_shufflevector ((vnx2sf) x, (vnx2sf) y, MASK_2);
73 *(vnx2sf *)out = v;
74 }
75
76 /* { dg-final { scan-assembler-times {\tvmerge.vvm} 8 } } */