Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/base/scalar_move-6.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-march=rv32gcv -mabi=ilp32d -fno-schedule-insns -fno-schedule-insns2 -O3" } */
3 /* { dg-final { check-function-bodies "**" "" } } */
4
5 #include "riscv_vector.h"
6
7 /*
8 ** foo:
9 ** addi\t[a-x0-9]+,\s*[a-x0-9]+,100
10 ** vsetvli\tzero,a2,e64,m2,t[au],m[au]
11 ** vlse64.v\tv[0-9]+,0\([a-x0-9]+\),zero
12 ** vs2r.v\tv[0-9]+,0\([a-x0-9]+\)
13 ** ret
14 */
15 void foo (void *base, void *out, size_t vl)
16 {
17 int64_t scalar = *(int64_t*)(base + 100);
18 vint64m2_t v = __riscv_vmv_s_x_i64m2 (scalar, vl);
19 *(vint64m2_t*)out = v;
20 }
21
22 /*
23 ** foo2:
24 ** fld\tfa[0-9]+,\s*100\(a0\)
25 ** vsetvli\tzero,a2,e64,m2,t[au],m[au]
26 ** vfmv\.v\.f\tv[0-9]+,\s*fa[0-9]+
27 ** vs2r.v\tv[0-9]+,0\([a-x0-9]+\)
28 ** ret
29 */
30 void foo2 (void *base, void *out, size_t vl)
31 {
32 double scalar = *(double*)(base + 100);
33 vfloat64m2_t v = __riscv_vfmv_s_f_f64m2 (scalar, vl);
34 *(vfloat64m2_t*)out = v;
35 }
36
37 /*
38 ** foo3:
39 ** ...
40 ** vlse64.v\tv[0-9]+,0\([a-x0-9]+\),zero
41 ** ...
42 ** ret
43 */
44 void foo3 (void *base, void *out, size_t vl)
45 {
46 int64_t scalar = *(int64_t*)(base + 100);
47 vint64m2_t merge = *(vint64m2_t*) (base + 200);
48 vint64m2_t v = __riscv_vmv_s_x_i64m2_tu (merge, scalar, vl);
49 *(vint64m2_t*)out = v;
50 }
51
52 /*
53 ** foo4:
54 ** ...
55 ** vfmv\.v\.f\tv[0-9]+,\s*fa[0-9]+
56 ** ...
57 ** ret
58 */
59 void foo4 (void *base, void *out, size_t vl)
60 {
61 double scalar = *(double*)(base + 100);
62 vfloat64m2_t merge = *(vfloat64m2_t*) (base + 200);
63 vfloat64m2_t v = __riscv_vfmv_s_f_f64m2_tu (merge, scalar, vl);
64 *(vfloat64m2_t*)out = v;
65 }
66
67 /*
68 ** foo5:
69 ** ...
70 ** vlse64.v\tv[0-9]+,0\([a-x0-9]+\),zero
71 ** ...
72 */
73 void foo5 (void *base, void *out, size_t vl, int64_t x)
74 {
75 vint64m2_t v = __riscv_vmv_s_x_i64m2 (x, vl);
76 *(vint64m2_t*)out = v;
77 }
78
79 /*
80 ** foo6:
81 ** ...
82 ** vfmv.s.f\tv[0-9]+,\s*[a-x0-9]+
83 ** ...
84 ** ret
85 */
86 void foo6 (void *base, void *out, size_t vl, double x)
87 {
88 vfloat64m2_t v = __riscv_vfmv_s_f_f64m2 (x, vl);
89 *(vfloat64m2_t*)out = v;
90 }
91
92 /*
93 ** foo7:
94 ** ...
95 ** vlse64.v\tv[0-9]+,0\([a-x0-9]+\),zero
96 ** ...
97 */
98 void foo7 (void *base, void *out, size_t vl, int64_t x)
99 {
100 vint64m2_t merge = *(vint64m2_t*) (base + 200);
101 vint64m2_t v = __riscv_vmv_s_x_i64m2_tu (merge, x, vl);
102 *(vint64m2_t*)out = v;
103 }
104
105 /*
106 ** foo8:
107 ** ...
108 ** vfmv.s.f\tv[0-9]+,\s*[a-x0-9]+
109 ** ...
110 ** ret
111 */
112 void foo8 (void *base, void *out, size_t vl, double x)
113 {
114 vfloat64m2_t merge = *(vfloat64m2_t*) (base + 200);
115 vfloat64m2_t v = __riscv_vfmv_s_f_f64m2_tu (merge, x, vl);
116 *(vfloat64m2_t*)out = v;
117 }
118
119 /*
120 ** foo9:
121 ** ...
122 ** vmv.s.x\tv[0-9]+,\s*[a-x0-9]+
123 ** ...
124 ** ret
125 */
126 void foo9 (void *base, void *out, size_t vl)
127 {
128 int64_t scalar = *(int64_t*)(base + 100);
129 vint64m2_t v = __riscv_vmv_s_x_i64m2 (-15, vl);
130 *(vint64m2_t*)out = v;
131 }
132
133 /*
134 ** foo10:
135 ** ...
136 ** vmv.s.x\tv[0-9]+,\s*[a-x0-9]+
137 ** ...
138 */
139 void foo10 (void *base, void *out, size_t vl)
140 {
141 int64_t scalar = *(int64_t*)(base + 100);
142 vint64m2_t merge = *(vint64m2_t*) (base + 200);
143 vint64m2_t v = __riscv_vmv_s_x_i64m2_tu (merge, -15, vl);
144 *(vint64m2_t*)out = v;
145 }
146
147 /*
148 ** foo11:
149 ** ...
150 ** vmv.s.x\tv[0-9]+,\s*zero
151 ** ...
152 ** ret
153 */
154 void foo11 (void *base, void *out, size_t vl)
155 {
156 double scalar = *(double*)(base + 100);
157 vfloat64m2_t v = __riscv_vfmv_s_f_f64m2 (0, vl);
158 *(vfloat64m2_t*)out = v;
159 }
160
161 /*
162 ** foo12:
163 ** ...
164 ** vmv.s.x\tv[0-9]+,\s*zero
165 ** ...
166 ** ret
167 */
168 void foo12 (void *base, void *out, size_t vl)
169 {
170 vfloat64m2_t merge = *(vfloat64m2_t*) (base + 200);
171 vfloat64m2_t v = __riscv_vfmv_s_f_f64m2_tu (merge, 0, vl);
172 *(vfloat64m2_t*)out = v;
173 }
174
175 /*
176 ** foo12_1:
177 ** ...
178 ** vfmv.s.f\tv[0-9]+,\s*[a-x0-9]+
179 ** ...
180 ** ret
181 */
182 void foo12_1 (void *base, void *out, size_t vl)
183 {
184 vfloat64m2_t merge = *(vfloat64m2_t*) (base + 200);
185 vfloat64m2_t v = __riscv_vfmv_s_f_f64m2_tu (merge, 0.2, vl);
186 *(vfloat64m2_t*)out = v;
187 }
188
189 /*
190 ** foo13:
191 ** ...
192 ** vmv.s.x\tv[0-9]+,\s*[a-x0-9]+
193 ** ...
194 ** ret
195 */
196 void foo13 (void *base, void *out, size_t vl)
197 {
198 int64_t scalar = *(int64_t*)(base + 100);
199 vint64m2_t v = __riscv_vmv_s_x_i64m2 (0xAAAAA, vl);
200 *(vint64m2_t*)out = v;
201 }
202
203 /*
204 ** foo14:
205 ** ...
206 ** vmv.s.x\tv[0-9]+,\s*[a-x0-9]+
207 ** ...
208 */
209 void foo14 (void *base, void *out, size_t vl)
210 {
211 int64_t scalar = *(int64_t*)(base + 100);
212 vint64m2_t merge = *(vint64m2_t*) (base + 200);
213 vint64m2_t v = __riscv_vmv_s_x_i64m2_tu (merge, 0xAAAAA, vl);
214 *(vint64m2_t*)out = v;
215 }