1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+d,+zfh,+zvfh,+v,+m -target-abi=ilp32d \
3 ; RUN: -verify-machineinstrs < %s | FileCheck %s
4 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh,+zvfh,+v,+m -target-abi=lp64d \
5 ; RUN: -verify-machineinstrs < %s | FileCheck %s
7 declare half @llvm.vector.reduce.fadd.nxv1f16(half, <vscale x 1 x half>)
9 define half @vreduce_fadd_nxv1f16(<vscale x 1 x half> %v, half %s) {
10 ; CHECK-LABEL: vreduce_fadd_nxv1f16:
12 ; CHECK-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
13 ; CHECK-NEXT: vfmv.s.f v9, fa0
14 ; CHECK-NEXT: vfredusum.vs v8, v8, v9
15 ; CHECK-NEXT: vfmv.f.s fa0, v8
17 %red = call reassoc half @llvm.vector.reduce.fadd.nxv1f16(half %s, <vscale x 1 x half> %v)
21 define half @vreduce_ord_fadd_nxv1f16(<vscale x 1 x half> %v, half %s) {
22 ; CHECK-LABEL: vreduce_ord_fadd_nxv1f16:
24 ; CHECK-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
25 ; CHECK-NEXT: vfmv.s.f v9, fa0
26 ; CHECK-NEXT: vfredosum.vs v8, v8, v9
27 ; CHECK-NEXT: vfmv.f.s fa0, v8
29 %red = call half @llvm.vector.reduce.fadd.nxv1f16(half %s, <vscale x 1 x half> %v)
33 declare half @llvm.vector.reduce.fadd.nxv2f16(half, <vscale x 2 x half>)
35 define half @vreduce_fadd_nxv2f16(<vscale x 2 x half> %v, half %s) {
36 ; CHECK-LABEL: vreduce_fadd_nxv2f16:
38 ; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
39 ; CHECK-NEXT: vfmv.s.f v9, fa0
40 ; CHECK-NEXT: vfredusum.vs v8, v8, v9
41 ; CHECK-NEXT: vfmv.f.s fa0, v8
43 %red = call reassoc half @llvm.vector.reduce.fadd.nxv2f16(half %s, <vscale x 2 x half> %v)
47 define half @vreduce_ord_fadd_nxv2f16(<vscale x 2 x half> %v, half %s) {
48 ; CHECK-LABEL: vreduce_ord_fadd_nxv2f16:
50 ; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
51 ; CHECK-NEXT: vfmv.s.f v9, fa0
52 ; CHECK-NEXT: vfredosum.vs v8, v8, v9
53 ; CHECK-NEXT: vfmv.f.s fa0, v8
55 %red = call half @llvm.vector.reduce.fadd.nxv2f16(half %s, <vscale x 2 x half> %v)
59 declare half @llvm.vector.reduce.fadd.nxv4f16(half, <vscale x 4 x half>)
61 define half @vreduce_fadd_nxv4f16(<vscale x 4 x half> %v, half %s) {
62 ; CHECK-LABEL: vreduce_fadd_nxv4f16:
64 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
65 ; CHECK-NEXT: vfmv.s.f v9, fa0
66 ; CHECK-NEXT: vfredusum.vs v8, v8, v9
67 ; CHECK-NEXT: vfmv.f.s fa0, v8
69 %red = call reassoc half @llvm.vector.reduce.fadd.nxv4f16(half %s, <vscale x 4 x half> %v)
73 define half @vreduce_ord_fadd_nxv4f16(<vscale x 4 x half> %v, half %s) {
74 ; CHECK-LABEL: vreduce_ord_fadd_nxv4f16:
76 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
77 ; CHECK-NEXT: vfmv.s.f v9, fa0
78 ; CHECK-NEXT: vfredosum.vs v8, v8, v9
79 ; CHECK-NEXT: vfmv.f.s fa0, v8
81 %red = call half @llvm.vector.reduce.fadd.nxv4f16(half %s, <vscale x 4 x half> %v)
85 declare float @llvm.vector.reduce.fadd.nxv1f32(float, <vscale x 1 x float>)
87 define float @vreduce_fadd_nxv1f32(<vscale x 1 x float> %v, float %s) {
88 ; CHECK-LABEL: vreduce_fadd_nxv1f32:
90 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
91 ; CHECK-NEXT: vfmv.s.f v9, fa0
92 ; CHECK-NEXT: vfredusum.vs v8, v8, v9
93 ; CHECK-NEXT: vfmv.f.s fa0, v8
95 %red = call reassoc float @llvm.vector.reduce.fadd.nxv1f32(float %s, <vscale x 1 x float> %v)
99 define float @vreduce_ord_fadd_nxv1f32(<vscale x 1 x float> %v, float %s) {
100 ; CHECK-LABEL: vreduce_ord_fadd_nxv1f32:
102 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
103 ; CHECK-NEXT: vfmv.s.f v9, fa0
104 ; CHECK-NEXT: vfredosum.vs v8, v8, v9
105 ; CHECK-NEXT: vfmv.f.s fa0, v8
107 %red = call float @llvm.vector.reduce.fadd.nxv1f32(float %s, <vscale x 1 x float> %v)
111 define float @vreduce_fwadd_nxv1f32(<vscale x 1 x half> %v, float %s) {
112 ; CHECK-LABEL: vreduce_fwadd_nxv1f32:
114 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
115 ; CHECK-NEXT: vfmv.s.f v9, fa0
116 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
117 ; CHECK-NEXT: vfwredusum.vs v8, v8, v9
118 ; CHECK-NEXT: vsetivli zero, 1, e32, m1, ta, ma
119 ; CHECK-NEXT: vfmv.f.s fa0, v8
121 %e = fpext <vscale x 1 x half> %v to <vscale x 1 x float>
122 %red = call reassoc float @llvm.vector.reduce.fadd.nxv1f32(float %s, <vscale x 1 x float> %e)
126 define float @vreduce_ord_fwadd_nxv1f32(<vscale x 1 x half> %v, float %s) {
127 ; CHECK-LABEL: vreduce_ord_fwadd_nxv1f32:
129 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
130 ; CHECK-NEXT: vfmv.s.f v9, fa0
131 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
132 ; CHECK-NEXT: vfwredosum.vs v8, v8, v9
133 ; CHECK-NEXT: vsetivli zero, 1, e32, m1, ta, ma
134 ; CHECK-NEXT: vfmv.f.s fa0, v8
136 %e = fpext <vscale x 1 x half> %v to <vscale x 1 x float>
137 %red = call float @llvm.vector.reduce.fadd.nxv1f32(float %s, <vscale x 1 x float> %e)
141 declare float @llvm.vector.reduce.fadd.nxv2f32(float, <vscale x 2 x float>)
143 define float @vreduce_fadd_nxv2f32(<vscale x 2 x float> %v, float %s) {
144 ; CHECK-LABEL: vreduce_fadd_nxv2f32:
146 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
147 ; CHECK-NEXT: vfmv.s.f v9, fa0
148 ; CHECK-NEXT: vfredusum.vs v8, v8, v9
149 ; CHECK-NEXT: vfmv.f.s fa0, v8
151 %red = call reassoc float @llvm.vector.reduce.fadd.nxv2f32(float %s, <vscale x 2 x float> %v)
155 define float @vreduce_ord_fadd_nxv2f32(<vscale x 2 x float> %v, float %s) {
156 ; CHECK-LABEL: vreduce_ord_fadd_nxv2f32:
158 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
159 ; CHECK-NEXT: vfmv.s.f v9, fa0
160 ; CHECK-NEXT: vfredosum.vs v8, v8, v9
161 ; CHECK-NEXT: vfmv.f.s fa0, v8
163 %red = call float @llvm.vector.reduce.fadd.nxv2f32(float %s, <vscale x 2 x float> %v)
167 define float @vreduce_fwadd_nxv2f32(<vscale x 2 x half> %v, float %s) {
168 ; CHECK-LABEL: vreduce_fwadd_nxv2f32:
170 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
171 ; CHECK-NEXT: vfmv.s.f v9, fa0
172 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
173 ; CHECK-NEXT: vfwredusum.vs v8, v8, v9
174 ; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, ma
175 ; CHECK-NEXT: vfmv.f.s fa0, v8
177 %e = fpext <vscale x 2 x half> %v to <vscale x 2 x float>
178 %red = call reassoc float @llvm.vector.reduce.fadd.nxv2f32(float %s, <vscale x 2 x float> %e)
182 define float @vreduce_ord_fwadd_nxv2f32(<vscale x 2 x half> %v, float %s) {
183 ; CHECK-LABEL: vreduce_ord_fwadd_nxv2f32:
185 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
186 ; CHECK-NEXT: vfmv.s.f v9, fa0
187 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
188 ; CHECK-NEXT: vfwredosum.vs v8, v8, v9
189 ; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, ma
190 ; CHECK-NEXT: vfmv.f.s fa0, v8
192 %e = fpext <vscale x 2 x half> %v to <vscale x 2 x float>
193 %red = call float @llvm.vector.reduce.fadd.nxv2f32(float %s, <vscale x 2 x float> %e)
197 declare float @llvm.vector.reduce.fadd.nxv4f32(float, <vscale x 4 x float>)
199 define float @vreduce_fadd_nxv4f32(<vscale x 4 x float> %v, float %s) {
200 ; CHECK-LABEL: vreduce_fadd_nxv4f32:
202 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
203 ; CHECK-NEXT: vfmv.s.f v10, fa0
204 ; CHECK-NEXT: vfredusum.vs v8, v8, v10
205 ; CHECK-NEXT: vfmv.f.s fa0, v8
207 %red = call reassoc float @llvm.vector.reduce.fadd.nxv4f32(float %s, <vscale x 4 x float> %v)
211 define float @vreduce_ord_fadd_nxv4f32(<vscale x 4 x float> %v, float %s) {
212 ; CHECK-LABEL: vreduce_ord_fadd_nxv4f32:
214 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
215 ; CHECK-NEXT: vfmv.s.f v10, fa0
216 ; CHECK-NEXT: vfredosum.vs v8, v8, v10
217 ; CHECK-NEXT: vfmv.f.s fa0, v8
219 %red = call float @llvm.vector.reduce.fadd.nxv4f32(float %s, <vscale x 4 x float> %v)
223 define float @vreduce_fwadd_nxv4f32(<vscale x 4 x half> %v, float %s) {
224 ; CHECK-LABEL: vreduce_fwadd_nxv4f32:
226 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
227 ; CHECK-NEXT: vfmv.s.f v9, fa0
228 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
229 ; CHECK-NEXT: vfwredusum.vs v8, v8, v9
230 ; CHECK-NEXT: vsetivli zero, 1, e32, m1, ta, ma
231 ; CHECK-NEXT: vfmv.f.s fa0, v8
233 %e = fpext <vscale x 4 x half> %v to <vscale x 4 x float>
234 %red = call reassoc float @llvm.vector.reduce.fadd.nxv4f32(float %s, <vscale x 4 x float> %e)
238 define float @vreduce_ord_fwadd_nxv4f32(<vscale x 4 x half> %v, float %s) {
239 ; CHECK-LABEL: vreduce_ord_fwadd_nxv4f32:
241 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
242 ; CHECK-NEXT: vfmv.s.f v9, fa0
243 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
244 ; CHECK-NEXT: vfwredosum.vs v8, v8, v9
245 ; CHECK-NEXT: vsetivli zero, 1, e32, m1, ta, ma
246 ; CHECK-NEXT: vfmv.f.s fa0, v8
248 %e = fpext <vscale x 4 x half> %v to <vscale x 4 x float>
249 %red = call float @llvm.vector.reduce.fadd.nxv4f32(float %s, <vscale x 4 x float> %e)
253 declare double @llvm.vector.reduce.fadd.nxv1f64(double, <vscale x 1 x double>)
255 define double @vreduce_fadd_nxv1f64(<vscale x 1 x double> %v, double %s) {
256 ; CHECK-LABEL: vreduce_fadd_nxv1f64:
258 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
259 ; CHECK-NEXT: vfmv.s.f v9, fa0
260 ; CHECK-NEXT: vfredusum.vs v8, v8, v9
261 ; CHECK-NEXT: vfmv.f.s fa0, v8
263 %red = call reassoc double @llvm.vector.reduce.fadd.nxv1f64(double %s, <vscale x 1 x double> %v)
267 define double @vreduce_ord_fadd_nxv1f64(<vscale x 1 x double> %v, double %s) {
268 ; CHECK-LABEL: vreduce_ord_fadd_nxv1f64:
270 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
271 ; CHECK-NEXT: vfmv.s.f v9, fa0
272 ; CHECK-NEXT: vfredosum.vs v8, v8, v9
273 ; CHECK-NEXT: vfmv.f.s fa0, v8
275 %red = call double @llvm.vector.reduce.fadd.nxv1f64(double %s, <vscale x 1 x double> %v)
279 define double @vreduce_fwadd_nxv1f64(<vscale x 1 x float> %v, double %s) {
280 ; CHECK-LABEL: vreduce_fwadd_nxv1f64:
282 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
283 ; CHECK-NEXT: vfmv.s.f v9, fa0
284 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
285 ; CHECK-NEXT: vfwredusum.vs v8, v8, v9
286 ; CHECK-NEXT: vsetvli zero, zero, e64, m1, ta, ma
287 ; CHECK-NEXT: vfmv.f.s fa0, v8
289 %e = fpext <vscale x 1 x float> %v to <vscale x 1 x double>
290 %red = call reassoc double @llvm.vector.reduce.fadd.nxv1f64(double %s, <vscale x 1 x double> %e)
294 define double @vreduce_ord_fwadd_nxv1f64(<vscale x 1 x float> %v, double %s) {
295 ; CHECK-LABEL: vreduce_ord_fwadd_nxv1f64:
297 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
298 ; CHECK-NEXT: vfmv.s.f v9, fa0
299 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
300 ; CHECK-NEXT: vfwredosum.vs v8, v8, v9
301 ; CHECK-NEXT: vsetvli zero, zero, e64, m1, ta, ma
302 ; CHECK-NEXT: vfmv.f.s fa0, v8
304 %e = fpext <vscale x 1 x float> %v to <vscale x 1 x double>
305 %red = call double @llvm.vector.reduce.fadd.nxv1f64(double %s, <vscale x 1 x double> %e)
309 declare double @llvm.vector.reduce.fadd.nxv2f64(double, <vscale x 2 x double>)
311 define double @vreduce_fadd_nxv2f64(<vscale x 2 x double> %v, double %s) {
312 ; CHECK-LABEL: vreduce_fadd_nxv2f64:
314 ; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma
315 ; CHECK-NEXT: vfmv.s.f v10, fa0
316 ; CHECK-NEXT: vfredusum.vs v8, v8, v10
317 ; CHECK-NEXT: vfmv.f.s fa0, v8
319 %red = call reassoc double @llvm.vector.reduce.fadd.nxv2f64(double %s, <vscale x 2 x double> %v)
323 define double @vreduce_ord_fadd_nxv2f64(<vscale x 2 x double> %v, double %s) {
324 ; CHECK-LABEL: vreduce_ord_fadd_nxv2f64:
326 ; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma
327 ; CHECK-NEXT: vfmv.s.f v10, fa0
328 ; CHECK-NEXT: vfredosum.vs v8, v8, v10
329 ; CHECK-NEXT: vfmv.f.s fa0, v8
331 %red = call double @llvm.vector.reduce.fadd.nxv2f64(double %s, <vscale x 2 x double> %v)
335 define double @vreduce_fwadd_nxv2f64(<vscale x 2 x float> %v, double %s) {
336 ; CHECK-LABEL: vreduce_fwadd_nxv2f64:
338 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
339 ; CHECK-NEXT: vfmv.s.f v9, fa0
340 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
341 ; CHECK-NEXT: vfwredusum.vs v8, v8, v9
342 ; CHECK-NEXT: vsetivli zero, 1, e64, m1, ta, ma
343 ; CHECK-NEXT: vfmv.f.s fa0, v8
345 %e = fpext <vscale x 2 x float> %v to <vscale x 2 x double>
346 %red = call reassoc double @llvm.vector.reduce.fadd.nxv2f64(double %s, <vscale x 2 x double> %e)
350 define double @vreduce_ord_fwadd_nxv2f64(<vscale x 2 x float> %v, double %s) {
351 ; CHECK-LABEL: vreduce_ord_fwadd_nxv2f64:
353 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
354 ; CHECK-NEXT: vfmv.s.f v9, fa0
355 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
356 ; CHECK-NEXT: vfwredosum.vs v8, v8, v9
357 ; CHECK-NEXT: vsetivli zero, 1, e64, m1, ta, ma
358 ; CHECK-NEXT: vfmv.f.s fa0, v8
360 %e = fpext <vscale x 2 x float> %v to <vscale x 2 x double>
361 %red = call double @llvm.vector.reduce.fadd.nxv2f64(double %s, <vscale x 2 x double> %e)
365 declare double @llvm.vector.reduce.fadd.nxv4f64(double, <vscale x 4 x double>)
367 define double @vreduce_fadd_nxv4f64(<vscale x 4 x double> %v, double %s) {
368 ; CHECK-LABEL: vreduce_fadd_nxv4f64:
370 ; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma
371 ; CHECK-NEXT: vfmv.s.f v12, fa0
372 ; CHECK-NEXT: vfredusum.vs v8, v8, v12
373 ; CHECK-NEXT: vfmv.f.s fa0, v8
375 %red = call reassoc double @llvm.vector.reduce.fadd.nxv4f64(double %s, <vscale x 4 x double> %v)
379 define double @vreduce_ord_fadd_nxv4f64(<vscale x 4 x double> %v, double %s) {
380 ; CHECK-LABEL: vreduce_ord_fadd_nxv4f64:
382 ; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma
383 ; CHECK-NEXT: vfmv.s.f v12, fa0
384 ; CHECK-NEXT: vfredosum.vs v8, v8, v12
385 ; CHECK-NEXT: vfmv.f.s fa0, v8
387 %red = call double @llvm.vector.reduce.fadd.nxv4f64(double %s, <vscale x 4 x double> %v)
391 define double @vreduce_fwadd_nxv4f64(<vscale x 4 x float> %v, double %s) {
392 ; CHECK-LABEL: vreduce_fwadd_nxv4f64:
394 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
395 ; CHECK-NEXT: vfmv.s.f v10, fa0
396 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
397 ; CHECK-NEXT: vfwredusum.vs v8, v8, v10
398 ; CHECK-NEXT: vsetivli zero, 1, e64, m1, ta, ma
399 ; CHECK-NEXT: vfmv.f.s fa0, v8
401 %e = fpext <vscale x 4 x float> %v to <vscale x 4 x double>
402 %red = call reassoc double @llvm.vector.reduce.fadd.nxv4f64(double %s, <vscale x 4 x double> %e)
406 define double @vreduce_ord_fwadd_nxv4f64(<vscale x 4 x float> %v, double %s) {
407 ; CHECK-LABEL: vreduce_ord_fwadd_nxv4f64:
409 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
410 ; CHECK-NEXT: vfmv.s.f v10, fa0
411 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
412 ; CHECK-NEXT: vfwredosum.vs v8, v8, v10
413 ; CHECK-NEXT: vsetivli zero, 1, e64, m1, ta, ma
414 ; CHECK-NEXT: vfmv.f.s fa0, v8
416 %e = fpext <vscale x 4 x float> %v to <vscale x 4 x double>
417 %red = call double @llvm.vector.reduce.fadd.nxv4f64(double %s, <vscale x 4 x double> %e)
421 declare half @llvm.vector.reduce.fmin.nxv1f16(<vscale x 1 x half>)
423 define half @vreduce_fmin_nxv1f16(<vscale x 1 x half> %v) {
424 ; CHECK-LABEL: vreduce_fmin_nxv1f16:
426 ; CHECK-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
427 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
428 ; CHECK-NEXT: vfmv.f.s fa0, v8
430 %red = call half @llvm.vector.reduce.fmin.nxv1f16(<vscale x 1 x half> %v)
434 define half @vreduce_fmin_nxv1f16_nonans(<vscale x 1 x half> %v) #0 {
435 ; CHECK-LABEL: vreduce_fmin_nxv1f16_nonans:
437 ; CHECK-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
438 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
439 ; CHECK-NEXT: vfmv.f.s fa0, v8
441 %red = call nnan half @llvm.vector.reduce.fmin.nxv1f16(<vscale x 1 x half> %v)
445 define half @vreduce_fmin_nxv1f16_nonans_noinfs(<vscale x 1 x half> %v) #1 {
446 ; CHECK-LABEL: vreduce_fmin_nxv1f16_nonans_noinfs:
448 ; CHECK-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
449 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
450 ; CHECK-NEXT: vfmv.f.s fa0, v8
452 %red = call nnan ninf half @llvm.vector.reduce.fmin.nxv1f16(<vscale x 1 x half> %v)
456 declare half @llvm.vector.reduce.fmin.nxv2f16(<vscale x 2 x half>)
458 define half @vreduce_fmin_nxv2f16(<vscale x 2 x half> %v) {
459 ; CHECK-LABEL: vreduce_fmin_nxv2f16:
461 ; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
462 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
463 ; CHECK-NEXT: vfmv.f.s fa0, v8
465 %red = call half @llvm.vector.reduce.fmin.nxv2f16(<vscale x 2 x half> %v)
469 declare half @llvm.vector.reduce.fmin.nxv4f16(<vscale x 4 x half>)
471 define half @vreduce_fmin_nxv4f16(<vscale x 4 x half> %v) {
472 ; CHECK-LABEL: vreduce_fmin_nxv4f16:
474 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
475 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
476 ; CHECK-NEXT: vfmv.f.s fa0, v8
478 %red = call half @llvm.vector.reduce.fmin.nxv4f16(<vscale x 4 x half> %v)
482 declare half @llvm.vector.reduce.fmin.nxv64f16(<vscale x 64 x half>)
484 define half @vreduce_fmin_nxv64f16(<vscale x 64 x half> %v) {
485 ; CHECK-LABEL: vreduce_fmin_nxv64f16:
487 ; CHECK-NEXT: vsetvli a0, zero, e16, m8, ta, ma
488 ; CHECK-NEXT: vfmin.vv v8, v8, v16
489 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
490 ; CHECK-NEXT: vfmv.f.s fa0, v8
492 %red = call half @llvm.vector.reduce.fmin.nxv64f16(<vscale x 64 x half> %v)
496 declare float @llvm.vector.reduce.fmin.nxv1f32(<vscale x 1 x float>)
498 define float @vreduce_fmin_nxv1f32(<vscale x 1 x float> %v) {
499 ; CHECK-LABEL: vreduce_fmin_nxv1f32:
501 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
502 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
503 ; CHECK-NEXT: vfmv.f.s fa0, v8
505 %red = call float @llvm.vector.reduce.fmin.nxv1f32(<vscale x 1 x float> %v)
509 define float @vreduce_fmin_nxv1f32_nonans(<vscale x 1 x float> %v) {
510 ; CHECK-LABEL: vreduce_fmin_nxv1f32_nonans:
512 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
513 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
514 ; CHECK-NEXT: vfmv.f.s fa0, v8
516 %red = call nnan float @llvm.vector.reduce.fmin.nxv1f32(<vscale x 1 x float> %v)
520 define float @vreduce_fmin_nxv1f32_nonans_noinfs(<vscale x 1 x float> %v) {
521 ; CHECK-LABEL: vreduce_fmin_nxv1f32_nonans_noinfs:
523 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
524 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
525 ; CHECK-NEXT: vfmv.f.s fa0, v8
527 %red = call nnan ninf float @llvm.vector.reduce.fmin.nxv1f32(<vscale x 1 x float> %v)
531 declare float @llvm.vector.reduce.fmin.nxv2f32(<vscale x 2 x float>)
533 define float @vreduce_fmin_nxv2f32(<vscale x 2 x float> %v) {
534 ; CHECK-LABEL: vreduce_fmin_nxv2f32:
536 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
537 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
538 ; CHECK-NEXT: vfmv.f.s fa0, v8
540 %red = call float @llvm.vector.reduce.fmin.nxv2f32(<vscale x 2 x float> %v)
544 declare float @llvm.vector.reduce.fmin.nxv4f32(<vscale x 4 x float>)
546 define float @vreduce_fmin_nxv4f32(<vscale x 4 x float> %v) {
547 ; CHECK-LABEL: vreduce_fmin_nxv4f32:
549 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
550 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
551 ; CHECK-NEXT: vfmv.f.s fa0, v8
553 %red = call float @llvm.vector.reduce.fmin.nxv4f32(<vscale x 4 x float> %v)
557 declare float @llvm.vector.reduce.fmin.nxv32f32(<vscale x 32 x float>)
559 define float @vreduce_fmin_nxv32f32(<vscale x 32 x float> %v) {
560 ; CHECK-LABEL: vreduce_fmin_nxv32f32:
562 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
563 ; CHECK-NEXT: vfmin.vv v8, v8, v16
564 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
565 ; CHECK-NEXT: vfmv.f.s fa0, v8
567 %red = call float @llvm.vector.reduce.fmin.nxv32f32(<vscale x 32 x float> %v)
571 declare double @llvm.vector.reduce.fmin.nxv1f64(<vscale x 1 x double>)
573 define double @vreduce_fmin_nxv1f64(<vscale x 1 x double> %v) {
574 ; CHECK-LABEL: vreduce_fmin_nxv1f64:
576 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
577 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
578 ; CHECK-NEXT: vfmv.f.s fa0, v8
580 %red = call double @llvm.vector.reduce.fmin.nxv1f64(<vscale x 1 x double> %v)
584 define double @vreduce_fmin_nxv1f64_nonans(<vscale x 1 x double> %v) {
585 ; CHECK-LABEL: vreduce_fmin_nxv1f64_nonans:
587 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
588 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
589 ; CHECK-NEXT: vfmv.f.s fa0, v8
591 %red = call nnan double @llvm.vector.reduce.fmin.nxv1f64(<vscale x 1 x double> %v)
595 define double @vreduce_fmin_nxv1f64_nonans_noinfs(<vscale x 1 x double> %v) {
596 ; CHECK-LABEL: vreduce_fmin_nxv1f64_nonans_noinfs:
598 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
599 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
600 ; CHECK-NEXT: vfmv.f.s fa0, v8
602 %red = call nnan ninf double @llvm.vector.reduce.fmin.nxv1f64(<vscale x 1 x double> %v)
606 declare double @llvm.vector.reduce.fmin.nxv2f64(<vscale x 2 x double>)
608 define double @vreduce_fmin_nxv2f64(<vscale x 2 x double> %v) {
609 ; CHECK-LABEL: vreduce_fmin_nxv2f64:
611 ; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma
612 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
613 ; CHECK-NEXT: vfmv.f.s fa0, v8
615 %red = call double @llvm.vector.reduce.fmin.nxv2f64(<vscale x 2 x double> %v)
619 declare double @llvm.vector.reduce.fmin.nxv4f64(<vscale x 4 x double>)
621 define double @vreduce_fmin_nxv4f64(<vscale x 4 x double> %v) {
622 ; CHECK-LABEL: vreduce_fmin_nxv4f64:
624 ; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma
625 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
626 ; CHECK-NEXT: vfmv.f.s fa0, v8
628 %red = call double @llvm.vector.reduce.fmin.nxv4f64(<vscale x 4 x double> %v)
632 declare double @llvm.vector.reduce.fmin.nxv16f64(<vscale x 16 x double>)
634 define double @vreduce_fmin_nxv16f64(<vscale x 16 x double> %v) {
635 ; CHECK-LABEL: vreduce_fmin_nxv16f64:
637 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
638 ; CHECK-NEXT: vfmin.vv v8, v8, v16
639 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
640 ; CHECK-NEXT: vfmv.f.s fa0, v8
642 %red = call double @llvm.vector.reduce.fmin.nxv16f64(<vscale x 16 x double> %v)
646 declare half @llvm.vector.reduce.fmax.nxv1f16(<vscale x 1 x half>)
648 define half @vreduce_fmax_nxv1f16(<vscale x 1 x half> %v) {
649 ; CHECK-LABEL: vreduce_fmax_nxv1f16:
651 ; CHECK-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
652 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
653 ; CHECK-NEXT: vfmv.f.s fa0, v8
655 %red = call half @llvm.vector.reduce.fmax.nxv1f16(<vscale x 1 x half> %v)
659 define half @vreduce_fmax_nxv1f16_nonans(<vscale x 1 x half> %v) #0 {
660 ; CHECK-LABEL: vreduce_fmax_nxv1f16_nonans:
662 ; CHECK-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
663 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
664 ; CHECK-NEXT: vfmv.f.s fa0, v8
666 %red = call nnan half @llvm.vector.reduce.fmax.nxv1f16(<vscale x 1 x half> %v)
670 define half @vreduce_fmax_nxv1f16_nonans_noinfs(<vscale x 1 x half> %v) #1 {
671 ; CHECK-LABEL: vreduce_fmax_nxv1f16_nonans_noinfs:
673 ; CHECK-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
674 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
675 ; CHECK-NEXT: vfmv.f.s fa0, v8
677 %red = call nnan ninf half @llvm.vector.reduce.fmax.nxv1f16(<vscale x 1 x half> %v)
681 declare half @llvm.vector.reduce.fmax.nxv2f16(<vscale x 2 x half>)
683 define half @vreduce_fmax_nxv2f16(<vscale x 2 x half> %v) {
684 ; CHECK-LABEL: vreduce_fmax_nxv2f16:
686 ; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
687 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
688 ; CHECK-NEXT: vfmv.f.s fa0, v8
690 %red = call half @llvm.vector.reduce.fmax.nxv2f16(<vscale x 2 x half> %v)
694 declare half @llvm.vector.reduce.fmax.nxv4f16(<vscale x 4 x half>)
696 define half @vreduce_fmax_nxv4f16(<vscale x 4 x half> %v) {
697 ; CHECK-LABEL: vreduce_fmax_nxv4f16:
699 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
700 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
701 ; CHECK-NEXT: vfmv.f.s fa0, v8
703 %red = call half @llvm.vector.reduce.fmax.nxv4f16(<vscale x 4 x half> %v)
707 declare half @llvm.vector.reduce.fmax.nxv64f16(<vscale x 64 x half>)
709 define half @vreduce_fmax_nxv64f16(<vscale x 64 x half> %v) {
710 ; CHECK-LABEL: vreduce_fmax_nxv64f16:
712 ; CHECK-NEXT: vsetvli a0, zero, e16, m8, ta, ma
713 ; CHECK-NEXT: vfmax.vv v8, v8, v16
714 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
715 ; CHECK-NEXT: vfmv.f.s fa0, v8
717 %red = call half @llvm.vector.reduce.fmax.nxv64f16(<vscale x 64 x half> %v)
721 declare float @llvm.vector.reduce.fmax.nxv1f32(<vscale x 1 x float>)
723 define float @vreduce_fmax_nxv1f32(<vscale x 1 x float> %v) {
724 ; CHECK-LABEL: vreduce_fmax_nxv1f32:
726 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
727 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
728 ; CHECK-NEXT: vfmv.f.s fa0, v8
730 %red = call float @llvm.vector.reduce.fmax.nxv1f32(<vscale x 1 x float> %v)
734 define float @vreduce_fmax_nxv1f32_nonans(<vscale x 1 x float> %v) {
735 ; CHECK-LABEL: vreduce_fmax_nxv1f32_nonans:
737 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
738 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
739 ; CHECK-NEXT: vfmv.f.s fa0, v8
741 %red = call nnan float @llvm.vector.reduce.fmax.nxv1f32(<vscale x 1 x float> %v)
745 define float @vreduce_fmax_nxv1f32_nonans_noinfs(<vscale x 1 x float> %v) {
746 ; CHECK-LABEL: vreduce_fmax_nxv1f32_nonans_noinfs:
748 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
749 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
750 ; CHECK-NEXT: vfmv.f.s fa0, v8
752 %red = call nnan ninf float @llvm.vector.reduce.fmax.nxv1f32(<vscale x 1 x float> %v)
756 declare float @llvm.vector.reduce.fmax.nxv2f32(<vscale x 2 x float>)
758 define float @vreduce_fmax_nxv2f32(<vscale x 2 x float> %v) {
759 ; CHECK-LABEL: vreduce_fmax_nxv2f32:
761 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
762 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
763 ; CHECK-NEXT: vfmv.f.s fa0, v8
765 %red = call float @llvm.vector.reduce.fmax.nxv2f32(<vscale x 2 x float> %v)
769 declare float @llvm.vector.reduce.fmax.nxv4f32(<vscale x 4 x float>)
771 define float @vreduce_fmax_nxv4f32(<vscale x 4 x float> %v) {
772 ; CHECK-LABEL: vreduce_fmax_nxv4f32:
774 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
775 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
776 ; CHECK-NEXT: vfmv.f.s fa0, v8
778 %red = call float @llvm.vector.reduce.fmax.nxv4f32(<vscale x 4 x float> %v)
782 declare float @llvm.vector.reduce.fmax.nxv32f32(<vscale x 32 x float>)
784 define float @vreduce_fmax_nxv32f32(<vscale x 32 x float> %v) {
785 ; CHECK-LABEL: vreduce_fmax_nxv32f32:
787 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
788 ; CHECK-NEXT: vfmax.vv v8, v8, v16
789 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
790 ; CHECK-NEXT: vfmv.f.s fa0, v8
792 %red = call float @llvm.vector.reduce.fmax.nxv32f32(<vscale x 32 x float> %v)
796 declare double @llvm.vector.reduce.fmax.nxv1f64(<vscale x 1 x double>)
798 define double @vreduce_fmax_nxv1f64(<vscale x 1 x double> %v) {
799 ; CHECK-LABEL: vreduce_fmax_nxv1f64:
801 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
802 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
803 ; CHECK-NEXT: vfmv.f.s fa0, v8
805 %red = call double @llvm.vector.reduce.fmax.nxv1f64(<vscale x 1 x double> %v)
809 define double @vreduce_fmax_nxv1f64_nonans(<vscale x 1 x double> %v) {
810 ; CHECK-LABEL: vreduce_fmax_nxv1f64_nonans:
812 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
813 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
814 ; CHECK-NEXT: vfmv.f.s fa0, v8
816 %red = call nnan double @llvm.vector.reduce.fmax.nxv1f64(<vscale x 1 x double> %v)
820 define double @vreduce_fmax_nxv1f64_nonans_noinfs(<vscale x 1 x double> %v) {
821 ; CHECK-LABEL: vreduce_fmax_nxv1f64_nonans_noinfs:
823 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
824 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
825 ; CHECK-NEXT: vfmv.f.s fa0, v8
827 %red = call nnan ninf double @llvm.vector.reduce.fmax.nxv1f64(<vscale x 1 x double> %v)
831 declare double @llvm.vector.reduce.fmax.nxv2f64(<vscale x 2 x double>)
833 define double @vreduce_fmax_nxv2f64(<vscale x 2 x double> %v) {
834 ; CHECK-LABEL: vreduce_fmax_nxv2f64:
836 ; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma
837 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
838 ; CHECK-NEXT: vfmv.f.s fa0, v8
840 %red = call double @llvm.vector.reduce.fmax.nxv2f64(<vscale x 2 x double> %v)
844 declare double @llvm.vector.reduce.fmax.nxv4f64(<vscale x 4 x double>)
846 define double @vreduce_fmax_nxv4f64(<vscale x 4 x double> %v) {
847 ; CHECK-LABEL: vreduce_fmax_nxv4f64:
849 ; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma
850 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
851 ; CHECK-NEXT: vfmv.f.s fa0, v8
853 %red = call double @llvm.vector.reduce.fmax.nxv4f64(<vscale x 4 x double> %v)
857 declare double @llvm.vector.reduce.fmax.nxv16f64(<vscale x 16 x double>)
859 define double @vreduce_fmax_nxv16f64(<vscale x 16 x double> %v) {
860 ; CHECK-LABEL: vreduce_fmax_nxv16f64:
862 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
863 ; CHECK-NEXT: vfmax.vv v8, v8, v16
864 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
865 ; CHECK-NEXT: vfmv.f.s fa0, v8
867 %red = call double @llvm.vector.reduce.fmax.nxv16f64(<vscale x 16 x double> %v)
871 define float @vreduce_nsz_fadd_nxv1f32(<vscale x 1 x float> %v, float %s) {
872 ; CHECK-LABEL: vreduce_nsz_fadd_nxv1f32:
874 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
875 ; CHECK-NEXT: vfmv.s.f v9, fa0
876 ; CHECK-NEXT: vfredusum.vs v8, v8, v9
877 ; CHECK-NEXT: vfmv.f.s fa0, v8
879 %red = call reassoc nsz float @llvm.vector.reduce.fadd.nxv1f32(float %s, <vscale x 1 x float> %v)
883 ; Test Widen VECREDUCE_SEQ_FADD
884 declare half @llvm.vector.reduce.fadd.nxv3f16(half, <vscale x 3 x half>)
886 define half @vreduce_ord_fadd_nxv3f16(<vscale x 3 x half> %v, half %s) {
887 ; CHECK-LABEL: vreduce_ord_fadd_nxv3f16:
889 ; CHECK-NEXT: csrr a0, vlenb
890 ; CHECK-NEXT: srli a0, a0, 3
891 ; CHECK-NEXT: slli a1, a0, 1
892 ; CHECK-NEXT: add a1, a1, a0
893 ; CHECK-NEXT: add a0, a1, a0
894 ; CHECK-NEXT: lui a2, 1048568
895 ; CHECK-NEXT: vsetvli a3, zero, e16, m1, ta, ma
896 ; CHECK-NEXT: vmv.v.x v9, a2
897 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, tu, ma
898 ; CHECK-NEXT: vslideup.vx v8, v9, a1
899 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
900 ; CHECK-NEXT: vfmv.s.f v9, fa0
901 ; CHECK-NEXT: vfredosum.vs v8, v8, v9
902 ; CHECK-NEXT: vfmv.f.s fa0, v8
904 %red = call half @llvm.vector.reduce.fadd.nxv3f16(half %s, <vscale x 3 x half> %v)
908 declare half @llvm.vector.reduce.fadd.nxv6f16(half, <vscale x 6 x half>)
910 define half @vreduce_ord_fadd_nxv6f16(<vscale x 6 x half> %v, half %s) {
911 ; CHECK-LABEL: vreduce_ord_fadd_nxv6f16:
913 ; CHECK-NEXT: lui a0, 1048568
914 ; CHECK-NEXT: vsetvli a1, zero, e16, m1, ta, ma
915 ; CHECK-NEXT: vmv.v.x v10, a0
916 ; CHECK-NEXT: csrr a0, vlenb
917 ; CHECK-NEXT: srli a0, a0, 2
918 ; CHECK-NEXT: add a1, a0, a0
919 ; CHECK-NEXT: vsetvli zero, a1, e16, m1, tu, ma
920 ; CHECK-NEXT: vslideup.vx v9, v10, a0
921 ; CHECK-NEXT: vsetvli a0, zero, e16, m2, ta, ma
922 ; CHECK-NEXT: vfmv.s.f v10, fa0
923 ; CHECK-NEXT: vfredosum.vs v8, v8, v10
924 ; CHECK-NEXT: vfmv.f.s fa0, v8
926 %red = call half @llvm.vector.reduce.fadd.nxv6f16(half %s, <vscale x 6 x half> %v)
930 declare half @llvm.vector.reduce.fadd.nxv10f16(half, <vscale x 10 x half>)
932 define half @vreduce_ord_fadd_nxv10f16(<vscale x 10 x half> %v, half %s) {
933 ; CHECK-LABEL: vreduce_ord_fadd_nxv10f16:
935 ; CHECK-NEXT: lui a0, 1048568
936 ; CHECK-NEXT: vsetvli a1, zero, e16, m1, ta, ma
937 ; CHECK-NEXT: vmv.v.x v12, a0
938 ; CHECK-NEXT: csrr a0, vlenb
939 ; CHECK-NEXT: srli a0, a0, 2
940 ; CHECK-NEXT: add a1, a0, a0
941 ; CHECK-NEXT: vsetvli zero, a1, e16, m1, tu, ma
942 ; CHECK-NEXT: vslideup.vx v10, v12, a0
943 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, tu, ma
944 ; CHECK-NEXT: vmv.v.v v11, v12
945 ; CHECK-NEXT: vsetvli zero, a1, e16, m1, tu, ma
946 ; CHECK-NEXT: vslideup.vx v11, v12, a0
947 ; CHECK-NEXT: vsetvli a0, zero, e16, m4, ta, ma
948 ; CHECK-NEXT: vfmv.s.f v12, fa0
949 ; CHECK-NEXT: vfredosum.vs v8, v8, v12
950 ; CHECK-NEXT: vfmv.f.s fa0, v8
952 %red = call half @llvm.vector.reduce.fadd.nxv10f16(half %s, <vscale x 10 x half> %v)
956 declare half @llvm.vector.reduce.fadd.nxv12f16(half, <vscale x 12 x half>)
958 define half @vreduce_ord_fadd_nxv12f16(<vscale x 12 x half> %v, half %s) {
959 ; CHECK-LABEL: vreduce_ord_fadd_nxv12f16:
961 ; CHECK-NEXT: lui a0, 1048568
962 ; CHECK-NEXT: vsetvli a1, zero, e16, m1, ta, ma
963 ; CHECK-NEXT: vmv.v.x v11, a0
964 ; CHECK-NEXT: vfmv.s.f v12, fa0
965 ; CHECK-NEXT: vsetvli a0, zero, e16, m4, ta, ma
966 ; CHECK-NEXT: vfredosum.vs v8, v8, v12
967 ; CHECK-NEXT: vfmv.f.s fa0, v8
969 %red = call half @llvm.vector.reduce.fadd.nxv12f16(half %s, <vscale x 12 x half> %v)
973 ; Test Widen vector reduce type (fadd/fmin/fmax)
974 define half @vreduce_fadd_nxv3f16(<vscale x 3 x half> %v, half %s) {
975 ; CHECK-LABEL: vreduce_fadd_nxv3f16:
977 ; CHECK-NEXT: csrr a0, vlenb
978 ; CHECK-NEXT: srli a0, a0, 3
979 ; CHECK-NEXT: slli a1, a0, 1
980 ; CHECK-NEXT: add a1, a1, a0
981 ; CHECK-NEXT: add a0, a1, a0
982 ; CHECK-NEXT: lui a2, 1048568
983 ; CHECK-NEXT: vsetvli a3, zero, e16, m1, ta, ma
984 ; CHECK-NEXT: vmv.v.x v9, a2
985 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, tu, ma
986 ; CHECK-NEXT: vslideup.vx v8, v9, a1
987 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
988 ; CHECK-NEXT: vfmv.s.f v9, fa0
989 ; CHECK-NEXT: vfredusum.vs v8, v8, v9
990 ; CHECK-NEXT: vfmv.f.s fa0, v8
992 %red = call reassoc half @llvm.vector.reduce.fadd.nxv3f16(half %s, <vscale x 3 x half> %v)
996 define half @vreduce_fadd_nxv6f16(<vscale x 6 x half> %v, half %s) {
997 ; CHECK-LABEL: vreduce_fadd_nxv6f16:
999 ; CHECK-NEXT: lui a0, 1048568
1000 ; CHECK-NEXT: vsetvli a1, zero, e16, m1, ta, ma
1001 ; CHECK-NEXT: vmv.v.x v10, a0
1002 ; CHECK-NEXT: csrr a0, vlenb
1003 ; CHECK-NEXT: srli a0, a0, 2
1004 ; CHECK-NEXT: add a1, a0, a0
1005 ; CHECK-NEXT: vsetvli zero, a1, e16, m1, tu, ma
1006 ; CHECK-NEXT: vslideup.vx v9, v10, a0
1007 ; CHECK-NEXT: vsetvli a0, zero, e16, m2, ta, ma
1008 ; CHECK-NEXT: vfmv.s.f v10, fa0
1009 ; CHECK-NEXT: vfredusum.vs v8, v8, v10
1010 ; CHECK-NEXT: vfmv.f.s fa0, v8
1012 %red = call reassoc half @llvm.vector.reduce.fadd.nxv6f16(half %s, <vscale x 6 x half> %v)
1016 declare half @llvm.vector.reduce.fmin.nxv10f16(<vscale x 10 x half>)
1018 define half @vreduce_fmin_nxv10f16(<vscale x 10 x half> %v) {
1019 ; CHECK-LABEL: vreduce_fmin_nxv10f16:
1021 ; CHECK-NEXT: csrr a0, vlenb
1022 ; CHECK-NEXT: lui a1, %hi(.LCPI73_0)
1023 ; CHECK-NEXT: addi a1, a1, %lo(.LCPI73_0)
1024 ; CHECK-NEXT: vsetvli a2, zero, e16, m1, ta, ma
1025 ; CHECK-NEXT: vlse16.v v12, (a1), zero
1026 ; CHECK-NEXT: srli a0, a0, 2
1027 ; CHECK-NEXT: add a1, a0, a0
1028 ; CHECK-NEXT: vsetvli zero, a1, e16, m1, tu, ma
1029 ; CHECK-NEXT: vslideup.vx v10, v12, a0
1030 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, tu, ma
1031 ; CHECK-NEXT: vmv.v.v v11, v12
1032 ; CHECK-NEXT: vsetvli zero, a1, e16, m1, tu, ma
1033 ; CHECK-NEXT: vslideup.vx v11, v12, a0
1034 ; CHECK-NEXT: vsetvli a0, zero, e16, m4, ta, ma
1035 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1036 ; CHECK-NEXT: vfmv.f.s fa0, v8
1038 %red = call half @llvm.vector.reduce.fmin.nxv10f16(<vscale x 10 x half> %v)
1042 declare half @llvm.vector.reduce.fmax.nxv12f16(<vscale x 12 x half>)
1044 define half @vreduce_fmax_nxv12f16(<vscale x 12 x half> %v) {
1045 ; CHECK-LABEL: vreduce_fmax_nxv12f16:
1047 ; CHECK-NEXT: li a0, -512
1048 ; CHECK-NEXT: vsetvli a1, zero, e16, m1, ta, ma
1049 ; CHECK-NEXT: vmv.v.x v11, a0
1050 ; CHECK-NEXT: vsetvli a0, zero, e16, m4, ta, ma
1051 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
1052 ; CHECK-NEXT: vfmv.f.s fa0, v8
1054 %red = call half @llvm.vector.reduce.fmax.nxv12f16(<vscale x 12 x half> %v)