Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/base/zero_base_load_store_optimization.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-march=rv64gcv -mabi=lp64 -O3" } */
3
4 #include "riscv_vector.h"
5
6 #define float32_t float
7
8 // Unit-Stride Load/Store
9 vint32m1_t test_vle32_v_i32m1_shortcut (size_t vl)
10 {
11 return __riscv_vle32_v_i32m1 ((int32_t *)0, vl);
12 }
13
14 vuint32m1_t test_vle32_v_u32m1_shortcut (size_t vl)
15 {
16 return __riscv_vle32_v_u32m1 ((int32_t *)0, vl);
17 }
18
19 vfloat32m1_t test_vle32_v_f32m1_shortcut (size_t vl)
20 {
21 return __riscv_vle32_v_f32m1 ((float32_t *)0, vl);
22 }
23
24 void test_vse32_v_i32m1_shortcut (vint32m1_t val, size_t vl)
25 {
26 __riscv_vse32_v_i32m1 ((int32_t *)0, val, vl);
27 }
28
29 void test_vse32_v_u32m1_shortcut (vuint32m1_t val, size_t vl)
30 {
31 __riscv_vse32_v_u32m1 ((uint32_t *)0, val, vl);
32 }
33
34 void test_vse32_v_f32m1_shortcut (vfloat32m1_t val, size_t vl)
35 {
36 __riscv_vse32_v_f32m1 ((float32_t *)0, val, vl);
37 }
38
39 // Stride Load/Store
40 vint32m1_t test_vlse32_v_i32m1_shortcut (ptrdiff_t bstride, size_t vl)
41 {
42 return __riscv_vlse32_v_i32m1 ((int32_t *)0, bstride, vl);
43 }
44
45 vuint32m1_t test_vlse32_v_u32m1_shortcut (ptrdiff_t bstride, size_t vl)
46 {
47 return __riscv_vlse32_v_u32m1 ((uint32_t *)0, bstride, vl);
48 }
49
50 vfloat32m1_t test_vlse32_v_f32m1_shortcut (ptrdiff_t bstride, size_t vl)
51 {
52 return __riscv_vlse32_v_f32m1 ((float32_t *)0, bstride, vl);
53 }
54
55 void test_vsse32_v_i32m1_shortcut (ptrdiff_t bstride, vint32m1_t val, size_t vl)
56 {
57 __riscv_vsse32_v_i32m1 ((int32_t *)0, bstride, val, vl);
58 }
59
60 void test_vsse32_v_u32m1_shortcut (ptrdiff_t bstride, vuint32m1_t val, size_t vl)
61 {
62 __riscv_vsse32_v_u32m1 ((uint32_t *)0, bstride, val, vl);
63 }
64
65 void test_vsse32_v_f32m1_shortcut (ptrdiff_t bstride, vfloat32m1_t val,size_t vl)
66 {
67 __riscv_vsse32_v_f32m1 ((float32_t *)0, bstride, val, vl);
68 }
69
70 // Indexed-Unordered Load/Store
71 vint32m1_t test_vluxei32_v_i32m1_shortcut (vuint32m1_t bindex, size_t vl)
72 {
73 return __riscv_vluxei32_v_i32m1 ((int32_t *)0, bindex, vl);
74 }
75
76 vuint32m1_t test_vluxei32_v_u32m1_shortcut (vuint32m1_t bindex, size_t vl)
77 {
78 return __riscv_vluxei32_v_u32m1 ((uint32_t *)0, bindex, vl);
79 }
80
81 vfloat32m1_t test_vluxei32_v_f32m1_shortcut (vuint32m1_t bindex, size_t vl)
82 {
83 return __riscv_vluxei32_v_f32m1 ((float32_t *)0, bindex, vl);
84 }
85
86 void test_vsuxei32_v_i32m1_shortcut (vuint32m1_t bindex, vint32m1_t val, size_t vl)
87 {
88 __riscv_vsuxei32_v_i32m1 ((int32_t *)0, bindex, val, vl);
89 }
90
91 void test_vsuxei32_v_u32m1_shortcut (vuint32m1_t bindex, vuint32m1_t val, size_t vl)
92 {
93 __riscv_vsuxei32_v_u32m1 ((uint32_t *)0, bindex, val, vl);
94 }
95
96 void test_vsuxei32_v_f32m1_shortcut (vuint32m1_t bindex, vfloat32m1_t val, size_t vl)
97 {
98 __riscv_vsuxei32_v_f32m1 ((float32_t *)0, bindex, val, vl);
99 }
100
101 // Indexed-Ordered Load/Store
102 vint32m1_t test_vloxei32_v_i32m1_shortcut (vuint32m1_t bindex, size_t vl)
103 {
104 return __riscv_vloxei32_v_i32m1 ((int32_t *)0, bindex, vl);
105 }
106
107 vuint32m1_t test_vloxei32_v_u32m1_shortcut (vuint32m1_t bindex, size_t vl)
108 {
109 return __riscv_vloxei32_v_u32m1 ((uint32_t *)0, bindex, vl);
110 }
111
112 vfloat32m1_t test_vloxei32_v_f32m1_shortcut (vuint32m1_t bindex, size_t vl)
113 {
114 return __riscv_vloxei32_v_f32m1 ((float32_t *)0, bindex, vl);
115 }
116
117 void test_vsoxei32_v_i32m1_shortcut (vuint32m1_t bindex, vint32m1_t val, size_t vl)
118 {
119 __riscv_vsoxei32_v_i32m1 ((int32_t *)0, bindex, val, vl);
120 }
121
122 void test_vsoxei32_v_u32m1_shortcut (vuint32m1_t bindex, vuint32m1_t val, size_t vl)
123 {
124 __riscv_vsoxei32_v_u32m1 ((uint32_t *)0, bindex, val, vl);
125 }
126
127 void test_vsoxei32_v_f32m1_shortcut (vuint32m1_t bindex, vfloat32m1_t val, size_t vl)
128 {
129 __riscv_vsoxei32_v_f32m1 ((float32_t *)0, bindex, val, vl);
130 }
131
132 /* { dg-final { scan-assembler-times {v[ls]e[0-9]+\.v\s+v[0-9]+,\s*0\(zero\)} 6 } } */
133 /* { dg-final { scan-assembler-times {v[ls]se[0-9]+\.v\s+v[0-9]+,\s*0\(zero\),\s*[ax][0-9]+} 6 } } */
134 /* { dg-final { scan-assembler-times {v[ls][uo]xei[0-9]+\.v\s+v[0-9]+,\s*\(zero\),\s*v[0-9]+} 12 } } */
135 /* { dg-final { scan-assembler-not {li\s+[a-x][0-9]+,\s*0} } } */