Debian Codegraph @

gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-vec-init-2.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O3 -fno-vect-cost-model -mlasx" } */
3 /* { dg-final { scan-assembler-times "vld" 12 } } */
4
5
6 typedef char v16qi __attribute__ ((vector_size (16)));
7 typedef char v32qi __attribute__ ((vector_size (32)));
8
9 typedef short v8hi __attribute__ ((vector_size (16)));
10 typedef short v16hi __attribute__ ((vector_size (32)));
11
12 typedef int v4si __attribute__ ((vector_size (16)));
13 typedef int v8si __attribute__ ((vector_size (32)));
14
15 typedef long v2di __attribute__ ((vector_size (16)));
16 typedef long v4di __attribute__ ((vector_size (32)));
17
18 typedef float v4sf __attribute__ ((vector_size (16)));
19 typedef float v8sf __attribute__ ((vector_size (32)));
20
21 typedef double v2df __attribute__ ((vector_size (16)));
22 typedef double v4df __attribute__ ((vector_size (32)));
23
24 v16qi a_qi, b_qi;
25 v8hi a_hi, b_hi;
26 v4si a_si, b_si;
27 v2di a_di, b_di;
28 v4sf a_sf, b_sf;
29 v2df a_df, b_df;
30
31 v32qi
32 foo_v32qi ()
33 {
34 return __builtin_shufflevector (a_qi, b_qi, 0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23, 8, 24, 9, 25, 10, 26, 11, 27, 12, 28, 13, 29, 14, 30, 15, 31);
35 }
36
37 v16hi
38 foo_v16qi ()
39 {
40 return __builtin_shufflevector (a_hi, b_hi, 0, 8, 1, 9, 2, 10, 3, 11, 4, 12, 5, 13, 6, 14, 7, 15);
41 }
42
43 v8si
44 foo_v8si ()
45 {
46 return __builtin_shufflevector (a_si, b_si, 0, 4, 1, 5, 2, 6, 3, 7);
47 }
48
49 v4di
50 foo_v4di ()
51 {
52 return __builtin_shufflevector (a_di, b_di, 0, 2, 1, 3);
53 }
54
55 v8sf
56 foo_v8sf ()
57 {
58 return __builtin_shufflevector (a_sf, b_sf, 0, 4, 1, 5, 2, 6, 3, 7);
59 }
60
61 v4df
62 foo_v4df ()
63 {
64 return __builtin_shufflevector (a_df, b_df, 0, 2, 1, 3);
65 }