1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -target-abi=ilp32d -mattr=+v,+zfh,+zvfh,+f,+d -verify-machineinstrs < %s | FileCheck %s
3 ; RUN: llc -mtriple=riscv64 -target-abi=lp64d -mattr=+v,+zfh,+zvfh,+f,+d -verify-machineinstrs < %s | FileCheck %s
5 declare half @llvm.vector.reduce.fadd.v1f16(half, <1 x half>)
7 define half @vreduce_fadd_v1f16(ptr %x, half %s) {
8 ; CHECK-LABEL: vreduce_fadd_v1f16:
10 ; CHECK-NEXT: vsetivli zero, 1, e16, mf4, ta, ma
11 ; CHECK-NEXT: vle16.v v8, (a0)
12 ; CHECK-NEXT: vfmv.f.s fa5, v8
13 ; CHECK-NEXT: fadd.h fa0, fa0, fa5
15 %v = load <1 x half>, ptr %x
16 %red = call reassoc half @llvm.vector.reduce.fadd.v1f16(half %s, <1 x half> %v)
20 define half @vreduce_ord_fadd_v1f16(ptr %x, half %s) {
21 ; CHECK-LABEL: vreduce_ord_fadd_v1f16:
23 ; CHECK-NEXT: vsetivli zero, 1, e16, mf4, ta, ma
24 ; CHECK-NEXT: vle16.v v8, (a0)
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 %v = load <1 x half>, ptr %x
30 %red = call half @llvm.vector.reduce.fadd.v1f16(half %s, <1 x half> %v)
34 declare half @llvm.vector.reduce.fadd.v2f16(half, <2 x half>)
36 define half @vreduce_fadd_v2f16(ptr %x, half %s) {
37 ; CHECK-LABEL: vreduce_fadd_v2f16:
39 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
40 ; CHECK-NEXT: vle16.v v8, (a0)
41 ; CHECK-NEXT: vfmv.s.f v9, fa0
42 ; CHECK-NEXT: vfredusum.vs v8, v8, v9
43 ; CHECK-NEXT: vfmv.f.s fa0, v8
45 %v = load <2 x half>, ptr %x
46 %red = call reassoc half @llvm.vector.reduce.fadd.v2f16(half %s, <2 x half> %v)
50 define half @vreduce_ord_fadd_v2f16(ptr %x, half %s) {
51 ; CHECK-LABEL: vreduce_ord_fadd_v2f16:
53 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
54 ; CHECK-NEXT: vle16.v v8, (a0)
55 ; CHECK-NEXT: vfmv.s.f v9, fa0
56 ; CHECK-NEXT: vfredosum.vs v8, v8, v9
57 ; CHECK-NEXT: vfmv.f.s fa0, v8
59 %v = load <2 x half>, ptr %x
60 %red = call half @llvm.vector.reduce.fadd.v2f16(half %s, <2 x half> %v)
64 declare half @llvm.vector.reduce.fadd.v4f16(half, <4 x half>)
66 define half @vreduce_fadd_v4f16(ptr %x, half %s) {
67 ; CHECK-LABEL: vreduce_fadd_v4f16:
69 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
70 ; CHECK-NEXT: vle16.v v8, (a0)
71 ; CHECK-NEXT: vfmv.s.f v9, fa0
72 ; CHECK-NEXT: vfredusum.vs v8, v8, v9
73 ; CHECK-NEXT: vfmv.f.s fa0, v8
75 %v = load <4 x half>, ptr %x
76 %red = call reassoc half @llvm.vector.reduce.fadd.v4f16(half %s, <4 x half> %v)
80 define half @vreduce_ord_fadd_v4f16(ptr %x, half %s) {
81 ; CHECK-LABEL: vreduce_ord_fadd_v4f16:
83 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
84 ; CHECK-NEXT: vle16.v v8, (a0)
85 ; CHECK-NEXT: vfmv.s.f v9, fa0
86 ; CHECK-NEXT: vfredosum.vs v8, v8, v9
87 ; CHECK-NEXT: vfmv.f.s fa0, v8
89 %v = load <4 x half>, ptr %x
90 %red = call half @llvm.vector.reduce.fadd.v4f16(half %s, <4 x half> %v)
94 declare half @llvm.vector.reduce.fadd.v8f16(half, <8 x half>)
96 define half @vreduce_fadd_v8f16(ptr %x, half %s) {
97 ; CHECK-LABEL: vreduce_fadd_v8f16:
99 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
100 ; CHECK-NEXT: vle16.v v8, (a0)
101 ; CHECK-NEXT: vfmv.s.f v9, fa0
102 ; CHECK-NEXT: vfredusum.vs v8, v8, v9
103 ; CHECK-NEXT: vfmv.f.s fa0, v8
105 %v = load <8 x half>, ptr %x
106 %red = call reassoc half @llvm.vector.reduce.fadd.v8f16(half %s, <8 x half> %v)
110 define half @vreduce_ord_fadd_v8f16(ptr %x, half %s) {
111 ; CHECK-LABEL: vreduce_ord_fadd_v8f16:
113 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
114 ; CHECK-NEXT: vle16.v v8, (a0)
115 ; CHECK-NEXT: vfmv.s.f v9, fa0
116 ; CHECK-NEXT: vfredosum.vs v8, v8, v9
117 ; CHECK-NEXT: vfmv.f.s fa0, v8
119 %v = load <8 x half>, ptr %x
120 %red = call half @llvm.vector.reduce.fadd.v8f16(half %s, <8 x half> %v)
124 declare half @llvm.vector.reduce.fadd.v16f16(half, <16 x half>)
126 define half @vreduce_fadd_v16f16(ptr %x, half %s) {
127 ; CHECK-LABEL: vreduce_fadd_v16f16:
129 ; CHECK-NEXT: vsetivli zero, 16, e16, m2, ta, ma
130 ; CHECK-NEXT: vle16.v v8, (a0)
131 ; CHECK-NEXT: vfmv.s.f v10, fa0
132 ; CHECK-NEXT: vfredusum.vs v8, v8, v10
133 ; CHECK-NEXT: vfmv.f.s fa0, v8
135 %v = load <16 x half>, ptr %x
136 %red = call reassoc half @llvm.vector.reduce.fadd.v16f16(half %s, <16 x half> %v)
140 define half @vreduce_ord_fadd_v16f16(ptr %x, half %s) {
141 ; CHECK-LABEL: vreduce_ord_fadd_v16f16:
143 ; CHECK-NEXT: vsetivli zero, 16, e16, m2, ta, ma
144 ; CHECK-NEXT: vle16.v v8, (a0)
145 ; CHECK-NEXT: vfmv.s.f v10, fa0
146 ; CHECK-NEXT: vfredosum.vs v8, v8, v10
147 ; CHECK-NEXT: vfmv.f.s fa0, v8
149 %v = load <16 x half>, ptr %x
150 %red = call half @llvm.vector.reduce.fadd.v16f16(half %s, <16 x half> %v)
154 declare half @llvm.vector.reduce.fadd.v32f16(half, <32 x half>)
156 define half @vreduce_fadd_v32f16(ptr %x, half %s) {
157 ; CHECK-LABEL: vreduce_fadd_v32f16:
159 ; CHECK-NEXT: li a1, 32
160 ; CHECK-NEXT: vsetvli zero, a1, e16, m4, ta, ma
161 ; CHECK-NEXT: vle16.v v8, (a0)
162 ; CHECK-NEXT: vfmv.s.f v12, fa0
163 ; CHECK-NEXT: vfredusum.vs v8, v8, v12
164 ; CHECK-NEXT: vfmv.f.s fa0, v8
166 %v = load <32 x half>, ptr %x
167 %red = call reassoc half @llvm.vector.reduce.fadd.v32f16(half %s, <32 x half> %v)
171 define half @vreduce_ord_fadd_v32f16(ptr %x, half %s) {
172 ; CHECK-LABEL: vreduce_ord_fadd_v32f16:
174 ; CHECK-NEXT: li a1, 32
175 ; CHECK-NEXT: vsetvli zero, a1, e16, m4, ta, ma
176 ; CHECK-NEXT: vle16.v v8, (a0)
177 ; CHECK-NEXT: vfmv.s.f v12, fa0
178 ; CHECK-NEXT: vfredosum.vs v8, v8, v12
179 ; CHECK-NEXT: vfmv.f.s fa0, v8
181 %v = load <32 x half>, ptr %x
182 %red = call half @llvm.vector.reduce.fadd.v32f16(half %s, <32 x half> %v)
186 declare half @llvm.vector.reduce.fadd.v64f16(half, <64 x half>)
188 define half @vreduce_fadd_v64f16(ptr %x, half %s) {
189 ; CHECK-LABEL: vreduce_fadd_v64f16:
191 ; CHECK-NEXT: li a1, 64
192 ; CHECK-NEXT: vsetvli zero, a1, e16, m8, ta, ma
193 ; CHECK-NEXT: vle16.v v8, (a0)
194 ; CHECK-NEXT: vfmv.s.f v16, fa0
195 ; CHECK-NEXT: vfredusum.vs v8, v8, v16
196 ; CHECK-NEXT: vfmv.f.s fa0, v8
198 %v = load <64 x half>, ptr %x
199 %red = call reassoc half @llvm.vector.reduce.fadd.v64f16(half %s, <64 x half> %v)
203 define half @vreduce_ord_fadd_v64f16(ptr %x, half %s) {
204 ; CHECK-LABEL: vreduce_ord_fadd_v64f16:
206 ; CHECK-NEXT: li a1, 64
207 ; CHECK-NEXT: vsetvli zero, a1, e16, m8, ta, ma
208 ; CHECK-NEXT: vle16.v v8, (a0)
209 ; CHECK-NEXT: vfmv.s.f v16, fa0
210 ; CHECK-NEXT: vfredosum.vs v8, v8, v16
211 ; CHECK-NEXT: vfmv.f.s fa0, v8
213 %v = load <64 x half>, ptr %x
214 %red = call half @llvm.vector.reduce.fadd.v64f16(half %s, <64 x half> %v)
218 declare half @llvm.vector.reduce.fadd.v128f16(half, <128 x half>)
220 define half @vreduce_fadd_v128f16(ptr %x, half %s) {
221 ; CHECK-LABEL: vreduce_fadd_v128f16:
223 ; CHECK-NEXT: li a1, 64
224 ; CHECK-NEXT: vsetvli zero, a1, e16, m8, ta, ma
225 ; CHECK-NEXT: vle16.v v8, (a0)
226 ; CHECK-NEXT: addi a0, a0, 128
227 ; CHECK-NEXT: vle16.v v16, (a0)
228 ; CHECK-NEXT: vfadd.vv v8, v8, v16
229 ; CHECK-NEXT: vfmv.s.f v16, fa0
230 ; CHECK-NEXT: vfredusum.vs v8, v8, v16
231 ; CHECK-NEXT: vfmv.f.s fa0, v8
233 %v = load <128 x half>, ptr %x
234 %red = call reassoc half @llvm.vector.reduce.fadd.v128f16(half %s, <128 x half> %v)
238 define half @vreduce_ord_fadd_v128f16(ptr %x, half %s) {
239 ; CHECK-LABEL: vreduce_ord_fadd_v128f16:
241 ; CHECK-NEXT: addi a1, a0, 128
242 ; CHECK-NEXT: li a2, 64
243 ; CHECK-NEXT: vsetvli zero, a2, e16, m8, ta, ma
244 ; CHECK-NEXT: vle16.v v8, (a0)
245 ; CHECK-NEXT: vle16.v v16, (a1)
246 ; CHECK-NEXT: vfmv.s.f v24, fa0
247 ; CHECK-NEXT: vfredosum.vs v8, v8, v24
248 ; CHECK-NEXT: vfredosum.vs v8, v16, v8
249 ; CHECK-NEXT: vfmv.f.s fa0, v8
251 %v = load <128 x half>, ptr %x
252 %red = call half @llvm.vector.reduce.fadd.v128f16(half %s, <128 x half> %v)
256 declare float @llvm.vector.reduce.fadd.v1f32(float, <1 x float>)
258 define float @vreduce_fadd_v1f32(ptr %x, float %s) {
259 ; CHECK-LABEL: vreduce_fadd_v1f32:
261 ; CHECK-NEXT: vsetivli zero, 1, e32, mf2, ta, ma
262 ; CHECK-NEXT: vle32.v v8, (a0)
263 ; CHECK-NEXT: vfmv.f.s fa5, v8
264 ; CHECK-NEXT: fadd.s fa0, fa0, fa5
266 %v = load <1 x float>, ptr %x
267 %red = call reassoc float @llvm.vector.reduce.fadd.v1f32(float %s, <1 x float> %v)
271 define float @vreduce_ord_fadd_v1f32(ptr %x, float %s) {
272 ; CHECK-LABEL: vreduce_ord_fadd_v1f32:
274 ; CHECK-NEXT: vsetivli zero, 1, e32, mf2, ta, ma
275 ; CHECK-NEXT: vle32.v v8, (a0)
276 ; CHECK-NEXT: vfmv.s.f v9, fa0
277 ; CHECK-NEXT: vfredosum.vs v8, v8, v9
278 ; CHECK-NEXT: vfmv.f.s fa0, v8
280 %v = load <1 x float>, ptr %x
281 %red = call float @llvm.vector.reduce.fadd.v1f32(float %s, <1 x float> %v)
285 define float @vreduce_fwadd_v1f32(ptr %x, float %s) {
286 ; CHECK-LABEL: vreduce_fwadd_v1f32:
288 ; CHECK-NEXT: vsetivli zero, 1, e16, mf4, ta, ma
289 ; CHECK-NEXT: vle16.v v8, (a0)
290 ; CHECK-NEXT: vfwcvt.f.f.v v9, v8
291 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
292 ; CHECK-NEXT: vfmv.f.s fa5, v9
293 ; CHECK-NEXT: fadd.s fa0, fa0, fa5
295 %v = load <1 x half>, ptr %x
296 %e = fpext <1 x half> %v to <1 x float>
297 %red = call reassoc float @llvm.vector.reduce.fadd.v1f32(float %s, <1 x float> %e)
301 define float @vreduce_ord_fwadd_v1f32(ptr %x, float %s) {
302 ; CHECK-LABEL: vreduce_ord_fwadd_v1f32:
304 ; CHECK-NEXT: vsetivli zero, 1, e32, mf2, ta, ma
305 ; CHECK-NEXT: vle16.v v8, (a0)
306 ; CHECK-NEXT: vfmv.s.f v9, fa0
307 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
308 ; CHECK-NEXT: vfwredosum.vs v8, v8, v9
309 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
310 ; CHECK-NEXT: vfmv.f.s fa0, v8
312 %v = load <1 x half>, ptr %x
313 %e = fpext <1 x half> %v to <1 x float>
314 %red = call float @llvm.vector.reduce.fadd.v1f32(float %s, <1 x float> %e)
318 declare float @llvm.vector.reduce.fadd.v2f32(float, <2 x float>)
320 define float @vreduce_fadd_v2f32(ptr %x, float %s) {
321 ; CHECK-LABEL: vreduce_fadd_v2f32:
323 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
324 ; CHECK-NEXT: vle32.v v8, (a0)
325 ; CHECK-NEXT: vfmv.s.f v9, fa0
326 ; CHECK-NEXT: vfredusum.vs v8, v8, v9
327 ; CHECK-NEXT: vfmv.f.s fa0, v8
329 %v = load <2 x float>, ptr %x
330 %red = call reassoc float @llvm.vector.reduce.fadd.v2f32(float %s, <2 x float> %v)
334 define float @vreduce_ord_fadd_v2f32(ptr %x, float %s) {
335 ; CHECK-LABEL: vreduce_ord_fadd_v2f32:
337 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
338 ; CHECK-NEXT: vle32.v v8, (a0)
339 ; CHECK-NEXT: vfmv.s.f v9, fa0
340 ; CHECK-NEXT: vfredosum.vs v8, v8, v9
341 ; CHECK-NEXT: vfmv.f.s fa0, v8
343 %v = load <2 x float>, ptr %x
344 %red = call float @llvm.vector.reduce.fadd.v2f32(float %s, <2 x float> %v)
348 define float @vreduce_fwadd_v2f32(ptr %x, float %s) {
349 ; CHECK-LABEL: vreduce_fwadd_v2f32:
351 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
352 ; CHECK-NEXT: vle16.v v8, (a0)
353 ; CHECK-NEXT: vfmv.s.f v9, fa0
354 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
355 ; CHECK-NEXT: vfwredusum.vs v8, v8, v9
356 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
357 ; CHECK-NEXT: vfmv.f.s fa0, v8
359 %v = load <2 x half>, ptr %x
360 %e = fpext <2 x half> %v to <2 x float>
361 %red = call reassoc float @llvm.vector.reduce.fadd.v2f32(float %s, <2 x float> %e)
365 define float @vreduce_ord_fwadd_v2f32(ptr %x, float %s) {
366 ; CHECK-LABEL: vreduce_ord_fwadd_v2f32:
368 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
369 ; CHECK-NEXT: vle16.v v8, (a0)
370 ; CHECK-NEXT: vfmv.s.f v9, fa0
371 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
372 ; CHECK-NEXT: vfwredosum.vs v8, v8, v9
373 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
374 ; CHECK-NEXT: vfmv.f.s fa0, v8
376 %v = load <2 x half>, ptr %x
377 %e = fpext <2 x half> %v to <2 x float>
378 %red = call float @llvm.vector.reduce.fadd.v2f32(float %s, <2 x float> %e)
382 declare float @llvm.vector.reduce.fadd.v4f32(float, <4 x float>)
384 define float @vreduce_fadd_v4f32(ptr %x, float %s) {
385 ; CHECK-LABEL: vreduce_fadd_v4f32:
387 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
388 ; CHECK-NEXT: vle32.v v8, (a0)
389 ; CHECK-NEXT: vfmv.s.f v9, fa0
390 ; CHECK-NEXT: vfredusum.vs v8, v8, v9
391 ; CHECK-NEXT: vfmv.f.s fa0, v8
393 %v = load <4 x float>, ptr %x
394 %red = call reassoc float @llvm.vector.reduce.fadd.v4f32(float %s, <4 x float> %v)
398 define float @vreduce_ord_fadd_v4f32(ptr %x, float %s) {
399 ; CHECK-LABEL: vreduce_ord_fadd_v4f32:
401 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
402 ; CHECK-NEXT: vle32.v v8, (a0)
403 ; CHECK-NEXT: vfmv.s.f v9, fa0
404 ; CHECK-NEXT: vfredosum.vs v8, v8, v9
405 ; CHECK-NEXT: vfmv.f.s fa0, v8
407 %v = load <4 x float>, ptr %x
408 %red = call float @llvm.vector.reduce.fadd.v4f32(float %s, <4 x float> %v)
412 define float @vreduce_fwadd_v4f32(ptr %x, float %s) {
413 ; CHECK-LABEL: vreduce_fwadd_v4f32:
415 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
416 ; CHECK-NEXT: vle16.v v8, (a0)
417 ; CHECK-NEXT: vfmv.s.f v9, fa0
418 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
419 ; CHECK-NEXT: vfwredusum.vs v8, v8, v9
420 ; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, ma
421 ; CHECK-NEXT: vfmv.f.s fa0, v8
423 %v = load <4 x half>, ptr %x
424 %e = fpext <4 x half> %v to <4 x float>
425 %red = call reassoc float @llvm.vector.reduce.fadd.v4f32(float %s, <4 x float> %e)
429 define float @vreduce_ord_fwadd_v4f32(ptr %x, float %s) {
430 ; CHECK-LABEL: vreduce_ord_fwadd_v4f32:
432 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
433 ; CHECK-NEXT: vle16.v v8, (a0)
434 ; CHECK-NEXT: vfmv.s.f v9, fa0
435 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
436 ; CHECK-NEXT: vfwredosum.vs v8, v8, v9
437 ; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, ma
438 ; CHECK-NEXT: vfmv.f.s fa0, v8
440 %v = load <4 x half>, ptr %x
441 %e = fpext <4 x half> %v to <4 x float>
442 %red = call float @llvm.vector.reduce.fadd.v4f32(float %s, <4 x float> %e)
446 declare float @llvm.vector.reduce.fadd.v8f32(float, <8 x float>)
448 define float @vreduce_fadd_v8f32(ptr %x, float %s) {
449 ; CHECK-LABEL: vreduce_fadd_v8f32:
451 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
452 ; CHECK-NEXT: vle32.v v8, (a0)
453 ; CHECK-NEXT: vfmv.s.f v10, fa0
454 ; CHECK-NEXT: vfredusum.vs v8, v8, v10
455 ; CHECK-NEXT: vfmv.f.s fa0, v8
457 %v = load <8 x float>, ptr %x
458 %red = call reassoc float @llvm.vector.reduce.fadd.v8f32(float %s, <8 x float> %v)
462 define float @vreduce_ord_fadd_v8f32(ptr %x, float %s) {
463 ; CHECK-LABEL: vreduce_ord_fadd_v8f32:
465 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
466 ; CHECK-NEXT: vle32.v v8, (a0)
467 ; CHECK-NEXT: vfmv.s.f v10, fa0
468 ; CHECK-NEXT: vfredosum.vs v8, v8, v10
469 ; CHECK-NEXT: vfmv.f.s fa0, v8
471 %v = load <8 x float>, ptr %x
472 %red = call float @llvm.vector.reduce.fadd.v8f32(float %s, <8 x float> %v)
476 define float @vreduce_fwadd_v8f32(ptr %x, float %s) {
477 ; CHECK-LABEL: vreduce_fwadd_v8f32:
479 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
480 ; CHECK-NEXT: vle16.v v8, (a0)
481 ; CHECK-NEXT: vfmv.s.f v9, fa0
482 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, ma
483 ; CHECK-NEXT: vfwredusum.vs v8, v8, v9
484 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, ma
485 ; CHECK-NEXT: vfmv.f.s fa0, v8
487 %v = load <8 x half>, ptr %x
488 %e = fpext <8 x half> %v to <8 x float>
489 %red = call reassoc float @llvm.vector.reduce.fadd.v8f32(float %s, <8 x float> %e)
493 define float @vreduce_ord_fwadd_v8f32(ptr %x, float %s) {
494 ; CHECK-LABEL: vreduce_ord_fwadd_v8f32:
496 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
497 ; CHECK-NEXT: vle16.v v8, (a0)
498 ; CHECK-NEXT: vfmv.s.f v9, fa0
499 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, ma
500 ; CHECK-NEXT: vfwredosum.vs v8, v8, v9
501 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, ma
502 ; CHECK-NEXT: vfmv.f.s fa0, v8
504 %v = load <8 x half>, ptr %x
505 %e = fpext <8 x half> %v to <8 x float>
506 %red = call float @llvm.vector.reduce.fadd.v8f32(float %s, <8 x float> %e)
510 declare float @llvm.vector.reduce.fadd.v16f32(float, <16 x float>)
512 define float @vreduce_fadd_v16f32(ptr %x, float %s) {
513 ; CHECK-LABEL: vreduce_fadd_v16f32:
515 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
516 ; CHECK-NEXT: vle32.v v8, (a0)
517 ; CHECK-NEXT: vfmv.s.f v12, fa0
518 ; CHECK-NEXT: vfredusum.vs v8, v8, v12
519 ; CHECK-NEXT: vfmv.f.s fa0, v8
521 %v = load <16 x float>, ptr %x
522 %red = call reassoc float @llvm.vector.reduce.fadd.v16f32(float %s, <16 x float> %v)
526 define float @vreduce_ord_fadd_v16f32(ptr %x, float %s) {
527 ; CHECK-LABEL: vreduce_ord_fadd_v16f32:
529 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
530 ; CHECK-NEXT: vle32.v v8, (a0)
531 ; CHECK-NEXT: vfmv.s.f v12, fa0
532 ; CHECK-NEXT: vfredosum.vs v8, v8, v12
533 ; CHECK-NEXT: vfmv.f.s fa0, v8
535 %v = load <16 x float>, ptr %x
536 %red = call float @llvm.vector.reduce.fadd.v16f32(float %s, <16 x float> %v)
540 define float @vreduce_fwadd_v16f32(ptr %x, float %s) {
541 ; CHECK-LABEL: vreduce_fwadd_v16f32:
543 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
544 ; CHECK-NEXT: vle16.v v8, (a0)
545 ; CHECK-NEXT: vfmv.s.f v10, fa0
546 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, ma
547 ; CHECK-NEXT: vfwredusum.vs v8, v8, v10
548 ; CHECK-NEXT: vsetvli zero, zero, e32, m4, ta, ma
549 ; CHECK-NEXT: vfmv.f.s fa0, v8
551 %v = load <16 x half>, ptr %x
552 %e = fpext <16 x half> %v to <16 x float>
553 %red = call reassoc float @llvm.vector.reduce.fadd.v16f32(float %s, <16 x float> %e)
557 define float @vreduce_ord_fwadd_v16f32(ptr %x, float %s) {
558 ; CHECK-LABEL: vreduce_ord_fwadd_v16f32:
560 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
561 ; CHECK-NEXT: vle16.v v8, (a0)
562 ; CHECK-NEXT: vfmv.s.f v10, fa0
563 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, ma
564 ; CHECK-NEXT: vfwredosum.vs v8, v8, v10
565 ; CHECK-NEXT: vsetvli zero, zero, e32, m4, ta, ma
566 ; CHECK-NEXT: vfmv.f.s fa0, v8
568 %v = load <16 x half>, ptr %x
569 %e = fpext <16 x half> %v to <16 x float>
570 %red = call float @llvm.vector.reduce.fadd.v16f32(float %s, <16 x float> %e)
574 declare float @llvm.vector.reduce.fadd.v32f32(float, <32 x float>)
576 define float @vreduce_fadd_v32f32(ptr %x, float %s) {
577 ; CHECK-LABEL: vreduce_fadd_v32f32:
579 ; CHECK-NEXT: li a1, 32
580 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
581 ; CHECK-NEXT: vle32.v v8, (a0)
582 ; CHECK-NEXT: vfmv.s.f v16, fa0
583 ; CHECK-NEXT: vfredusum.vs v8, v8, v16
584 ; CHECK-NEXT: vfmv.f.s fa0, v8
586 %v = load <32 x float>, ptr %x
587 %red = call reassoc float @llvm.vector.reduce.fadd.v32f32(float %s, <32 x float> %v)
591 define float @vreduce_ord_fadd_v32f32(ptr %x, float %s) {
592 ; CHECK-LABEL: vreduce_ord_fadd_v32f32:
594 ; CHECK-NEXT: li a1, 32
595 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
596 ; CHECK-NEXT: vle32.v v8, (a0)
597 ; CHECK-NEXT: vfmv.s.f v16, fa0
598 ; CHECK-NEXT: vfredosum.vs v8, v8, v16
599 ; CHECK-NEXT: vfmv.f.s fa0, v8
601 %v = load <32 x float>, ptr %x
602 %red = call float @llvm.vector.reduce.fadd.v32f32(float %s, <32 x float> %v)
606 define float @vreduce_fwadd_v32f32(ptr %x, float %s) {
607 ; CHECK-LABEL: vreduce_fwadd_v32f32:
609 ; CHECK-NEXT: li a1, 32
610 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
611 ; CHECK-NEXT: vle16.v v8, (a0)
612 ; CHECK-NEXT: vfmv.s.f v12, fa0
613 ; CHECK-NEXT: vsetvli zero, zero, e16, m4, ta, ma
614 ; CHECK-NEXT: vfwredusum.vs v8, v8, v12
615 ; CHECK-NEXT: vsetvli zero, zero, e32, m8, ta, ma
616 ; CHECK-NEXT: vfmv.f.s fa0, v8
618 %v = load <32 x half>, ptr %x
619 %e = fpext <32 x half> %v to <32 x float>
620 %red = call reassoc float @llvm.vector.reduce.fadd.v32f32(float %s, <32 x float> %e)
624 define float @vreduce_ord_fwadd_v32f32(ptr %x, float %s) {
625 ; CHECK-LABEL: vreduce_ord_fwadd_v32f32:
627 ; CHECK-NEXT: li a1, 32
628 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
629 ; CHECK-NEXT: vle16.v v8, (a0)
630 ; CHECK-NEXT: vfmv.s.f v12, fa0
631 ; CHECK-NEXT: vsetvli zero, zero, e16, m4, ta, ma
632 ; CHECK-NEXT: vfwredosum.vs v8, v8, v12
633 ; CHECK-NEXT: vsetvli zero, zero, e32, m8, ta, ma
634 ; CHECK-NEXT: vfmv.f.s fa0, v8
636 %v = load <32 x half>, ptr %x
637 %e = fpext <32 x half> %v to <32 x float>
638 %red = call float @llvm.vector.reduce.fadd.v32f32(float %s, <32 x float> %e)
642 declare float @llvm.vector.reduce.fadd.v64f32(float, <64 x float>)
644 define float @vreduce_fadd_v64f32(ptr %x, float %s) {
645 ; CHECK-LABEL: vreduce_fadd_v64f32:
647 ; CHECK-NEXT: li a1, 32
648 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
649 ; CHECK-NEXT: vle32.v v8, (a0)
650 ; CHECK-NEXT: addi a0, a0, 128
651 ; CHECK-NEXT: vle32.v v16, (a0)
652 ; CHECK-NEXT: vfadd.vv v8, v8, v16
653 ; CHECK-NEXT: vfmv.s.f v16, fa0
654 ; CHECK-NEXT: vfredusum.vs v8, v8, v16
655 ; CHECK-NEXT: vfmv.f.s fa0, v8
657 %v = load <64 x float>, ptr %x
658 %red = call reassoc float @llvm.vector.reduce.fadd.v64f32(float %s, <64 x float> %v)
662 define float @vreduce_ord_fadd_v64f32(ptr %x, float %s) {
663 ; CHECK-LABEL: vreduce_ord_fadd_v64f32:
665 ; CHECK-NEXT: addi a1, a0, 128
666 ; CHECK-NEXT: li a2, 32
667 ; CHECK-NEXT: vsetvli zero, a2, e32, m8, ta, ma
668 ; CHECK-NEXT: vle32.v v8, (a0)
669 ; CHECK-NEXT: vle32.v v16, (a1)
670 ; CHECK-NEXT: vfmv.s.f v24, fa0
671 ; CHECK-NEXT: vfredosum.vs v8, v8, v24
672 ; CHECK-NEXT: vfredosum.vs v8, v16, v8
673 ; CHECK-NEXT: vfmv.f.s fa0, v8
675 %v = load <64 x float>, ptr %x
676 %red = call float @llvm.vector.reduce.fadd.v64f32(float %s, <64 x float> %v)
680 define float @vreduce_fwadd_v64f32(ptr %x, float %s) {
681 ; CHECK-LABEL: vreduce_fwadd_v64f32:
683 ; CHECK-NEXT: li a1, 64
684 ; CHECK-NEXT: vsetvli zero, a1, e16, m8, ta, ma
685 ; CHECK-NEXT: vle16.v v8, (a0)
686 ; CHECK-NEXT: li a0, 32
687 ; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, ma
688 ; CHECK-NEXT: vslidedown.vx v16, v8, a0
689 ; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, ma
690 ; CHECK-NEXT: vfwadd.vv v24, v8, v16
691 ; CHECK-NEXT: vsetvli zero, zero, e32, m8, ta, ma
692 ; CHECK-NEXT: vfmv.s.f v8, fa0
693 ; CHECK-NEXT: vfredusum.vs v8, v24, v8
694 ; CHECK-NEXT: vfmv.f.s fa0, v8
696 %v = load <64 x half>, ptr %x
697 %e = fpext <64 x half> %v to <64 x float>
698 %red = call reassoc float @llvm.vector.reduce.fadd.v64f32(float %s, <64 x float> %e)
702 define float @vreduce_ord_fwadd_v64f32(ptr %x, float %s) {
703 ; CHECK-LABEL: vreduce_ord_fwadd_v64f32:
705 ; CHECK-NEXT: li a1, 64
706 ; CHECK-NEXT: vsetvli zero, a1, e16, m8, ta, ma
707 ; CHECK-NEXT: vle16.v v8, (a0)
708 ; CHECK-NEXT: li a0, 32
709 ; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, ma
710 ; CHECK-NEXT: vslidedown.vx v16, v8, a0
711 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
712 ; CHECK-NEXT: vfmv.s.f v12, fa0
713 ; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, ma
714 ; CHECK-NEXT: vfwredosum.vs v8, v8, v12
715 ; CHECK-NEXT: vfwredosum.vs v8, v16, v8
716 ; CHECK-NEXT: vsetvli zero, zero, e32, m8, ta, ma
717 ; CHECK-NEXT: vfmv.f.s fa0, v8
719 %v = load <64 x half>, ptr %x
720 %e = fpext <64 x half> %v to <64 x float>
721 %red = call float @llvm.vector.reduce.fadd.v64f32(float %s, <64 x float> %e)
725 declare double @llvm.vector.reduce.fadd.v1f64(double, <1 x double>)
727 define double @vreduce_fadd_v1f64(ptr %x, double %s) {
728 ; CHECK-LABEL: vreduce_fadd_v1f64:
730 ; CHECK-NEXT: vsetivli zero, 1, e64, m1, ta, ma
731 ; CHECK-NEXT: vle64.v v8, (a0)
732 ; CHECK-NEXT: vfmv.f.s fa5, v8
733 ; CHECK-NEXT: fadd.d fa0, fa0, fa5
735 %v = load <1 x double>, ptr %x
736 %red = call reassoc double @llvm.vector.reduce.fadd.v1f64(double %s, <1 x double> %v)
740 define double @vreduce_ord_fadd_v1f64(ptr %x, double %s) {
741 ; CHECK-LABEL: vreduce_ord_fadd_v1f64:
743 ; CHECK-NEXT: vsetivli zero, 1, e64, m1, ta, ma
744 ; CHECK-NEXT: vle64.v v8, (a0)
745 ; CHECK-NEXT: vfmv.s.f v9, fa0
746 ; CHECK-NEXT: vfredosum.vs v8, v8, v9
747 ; CHECK-NEXT: vfmv.f.s fa0, v8
749 %v = load <1 x double>, ptr %x
750 %red = call double @llvm.vector.reduce.fadd.v1f64(double %s, <1 x double> %v)
754 define double @vreduce_fwadd_v1f64(ptr %x, double %s) {
755 ; CHECK-LABEL: vreduce_fwadd_v1f64:
757 ; CHECK-NEXT: vsetivli zero, 1, e32, mf2, ta, ma
758 ; CHECK-NEXT: vle32.v v8, (a0)
759 ; CHECK-NEXT: vfwcvt.f.f.v v9, v8
760 ; CHECK-NEXT: vsetvli zero, zero, e64, m1, ta, ma
761 ; CHECK-NEXT: vfmv.f.s fa5, v9
762 ; CHECK-NEXT: fadd.d fa0, fa0, fa5
764 %v = load <1 x float>, ptr %x
765 %e = fpext <1 x float> %v to <1 x double>
766 %red = call reassoc double @llvm.vector.reduce.fadd.v1f64(double %s, <1 x double> %e)
770 define double @vreduce_ord_fwadd_v1f64(ptr %x, double %s) {
771 ; CHECK-LABEL: vreduce_ord_fwadd_v1f64:
773 ; CHECK-NEXT: vsetivli zero, 1, e64, m1, ta, ma
774 ; CHECK-NEXT: vle32.v v8, (a0)
775 ; CHECK-NEXT: vfmv.s.f v9, fa0
776 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
777 ; CHECK-NEXT: vfwredosum.vs v8, v8, v9
778 ; CHECK-NEXT: vsetvli zero, zero, e64, m1, ta, ma
779 ; CHECK-NEXT: vfmv.f.s fa0, v8
781 %v = load <1 x float>, ptr %x
782 %e = fpext <1 x float> %v to <1 x double>
783 %red = call double @llvm.vector.reduce.fadd.v1f64(double %s, <1 x double> %e)
787 declare double @llvm.vector.reduce.fadd.v2f64(double, <2 x double>)
789 define double @vreduce_fadd_v2f64(ptr %x, double %s) {
790 ; CHECK-LABEL: vreduce_fadd_v2f64:
792 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
793 ; CHECK-NEXT: vle64.v v8, (a0)
794 ; CHECK-NEXT: vfmv.s.f v9, fa0
795 ; CHECK-NEXT: vfredusum.vs v8, v8, v9
796 ; CHECK-NEXT: vfmv.f.s fa0, v8
798 %v = load <2 x double>, ptr %x
799 %red = call reassoc double @llvm.vector.reduce.fadd.v2f64(double %s, <2 x double> %v)
803 define double @vreduce_ord_fadd_v2f64(ptr %x, double %s) {
804 ; CHECK-LABEL: vreduce_ord_fadd_v2f64:
806 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
807 ; CHECK-NEXT: vle64.v v8, (a0)
808 ; CHECK-NEXT: vfmv.s.f v9, fa0
809 ; CHECK-NEXT: vfredosum.vs v8, v8, v9
810 ; CHECK-NEXT: vfmv.f.s fa0, v8
812 %v = load <2 x double>, ptr %x
813 %red = call double @llvm.vector.reduce.fadd.v2f64(double %s, <2 x double> %v)
817 define double @vreduce_fwadd_v2f64(ptr %x, double %s) {
818 ; CHECK-LABEL: vreduce_fwadd_v2f64:
820 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
821 ; CHECK-NEXT: vle32.v v8, (a0)
822 ; CHECK-NEXT: vfmv.s.f v9, fa0
823 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
824 ; CHECK-NEXT: vfwredusum.vs v8, v8, v9
825 ; CHECK-NEXT: vsetvli zero, zero, e64, m1, ta, ma
826 ; CHECK-NEXT: vfmv.f.s fa0, v8
828 %v = load <2 x float>, ptr %x
829 %e = fpext <2 x float> %v to <2 x double>
830 %red = call reassoc double @llvm.vector.reduce.fadd.v2f64(double %s, <2 x double> %e)
834 define double @vreduce_ord_fwadd_v2f64(ptr %x, double %s) {
835 ; CHECK-LABEL: vreduce_ord_fwadd_v2f64:
837 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
838 ; CHECK-NEXT: vle32.v v8, (a0)
839 ; CHECK-NEXT: vfmv.s.f v9, fa0
840 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
841 ; CHECK-NEXT: vfwredosum.vs v8, v8, v9
842 ; CHECK-NEXT: vsetvli zero, zero, e64, m1, ta, ma
843 ; CHECK-NEXT: vfmv.f.s fa0, v8
845 %v = load <2 x float>, ptr %x
846 %e = fpext <2 x float> %v to <2 x double>
847 %red = call double @llvm.vector.reduce.fadd.v2f64(double %s, <2 x double> %e)
851 declare double @llvm.vector.reduce.fadd.v4f64(double, <4 x double>)
853 define double @vreduce_fadd_v4f64(ptr %x, double %s) {
854 ; CHECK-LABEL: vreduce_fadd_v4f64:
856 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
857 ; CHECK-NEXT: vle64.v v8, (a0)
858 ; CHECK-NEXT: vfmv.s.f v10, fa0
859 ; CHECK-NEXT: vfredusum.vs v8, v8, v10
860 ; CHECK-NEXT: vfmv.f.s fa0, v8
862 %v = load <4 x double>, ptr %x
863 %red = call reassoc double @llvm.vector.reduce.fadd.v4f64(double %s, <4 x double> %v)
867 define double @vreduce_ord_fadd_v4f64(ptr %x, double %s) {
868 ; CHECK-LABEL: vreduce_ord_fadd_v4f64:
870 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
871 ; CHECK-NEXT: vle64.v v8, (a0)
872 ; CHECK-NEXT: vfmv.s.f v10, fa0
873 ; CHECK-NEXT: vfredosum.vs v8, v8, v10
874 ; CHECK-NEXT: vfmv.f.s fa0, v8
876 %v = load <4 x double>, ptr %x
877 %red = call double @llvm.vector.reduce.fadd.v4f64(double %s, <4 x double> %v)
881 define double @vreduce_fwadd_v4f64(ptr %x, double %s) {
882 ; CHECK-LABEL: vreduce_fwadd_v4f64:
884 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
885 ; CHECK-NEXT: vle32.v v8, (a0)
886 ; CHECK-NEXT: vfmv.s.f v9, fa0
887 ; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, ma
888 ; CHECK-NEXT: vfwredusum.vs v8, v8, v9
889 ; CHECK-NEXT: vsetvli zero, zero, e64, m2, ta, ma
890 ; CHECK-NEXT: vfmv.f.s fa0, v8
892 %v = load <4 x float>, ptr %x
893 %e = fpext <4 x float> %v to <4 x double>
894 %red = call reassoc double @llvm.vector.reduce.fadd.v4f64(double %s, <4 x double> %e)
898 define double @vreduce_ord_fwadd_v4f64(ptr %x, double %s) {
899 ; CHECK-LABEL: vreduce_ord_fwadd_v4f64:
901 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
902 ; CHECK-NEXT: vle32.v v8, (a0)
903 ; CHECK-NEXT: vfmv.s.f v9, fa0
904 ; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, ma
905 ; CHECK-NEXT: vfwredosum.vs v8, v8, v9
906 ; CHECK-NEXT: vsetvli zero, zero, e64, m2, ta, ma
907 ; CHECK-NEXT: vfmv.f.s fa0, v8
909 %v = load <4 x float>, ptr %x
910 %e = fpext <4 x float> %v to <4 x double>
911 %red = call double @llvm.vector.reduce.fadd.v4f64(double %s, <4 x double> %e)
915 declare double @llvm.vector.reduce.fadd.v8f64(double, <8 x double>)
917 define double @vreduce_fadd_v8f64(ptr %x, double %s) {
918 ; CHECK-LABEL: vreduce_fadd_v8f64:
920 ; CHECK-NEXT: vsetivli zero, 8, e64, m4, ta, ma
921 ; CHECK-NEXT: vle64.v v8, (a0)
922 ; CHECK-NEXT: vfmv.s.f v12, fa0
923 ; CHECK-NEXT: vfredusum.vs v8, v8, v12
924 ; CHECK-NEXT: vfmv.f.s fa0, v8
926 %v = load <8 x double>, ptr %x
927 %red = call reassoc double @llvm.vector.reduce.fadd.v8f64(double %s, <8 x double> %v)
931 define double @vreduce_ord_fadd_v8f64(ptr %x, double %s) {
932 ; CHECK-LABEL: vreduce_ord_fadd_v8f64:
934 ; CHECK-NEXT: vsetivli zero, 8, e64, m4, ta, ma
935 ; CHECK-NEXT: vle64.v v8, (a0)
936 ; CHECK-NEXT: vfmv.s.f v12, fa0
937 ; CHECK-NEXT: vfredosum.vs v8, v8, v12
938 ; CHECK-NEXT: vfmv.f.s fa0, v8
940 %v = load <8 x double>, ptr %x
941 %red = call double @llvm.vector.reduce.fadd.v8f64(double %s, <8 x double> %v)
945 define double @vreduce_fwadd_v8f64(ptr %x, double %s) {
946 ; CHECK-LABEL: vreduce_fwadd_v8f64:
948 ; CHECK-NEXT: vsetivli zero, 8, e64, m4, ta, ma
949 ; CHECK-NEXT: vle32.v v8, (a0)
950 ; CHECK-NEXT: vfmv.s.f v10, fa0
951 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, ma
952 ; CHECK-NEXT: vfwredusum.vs v8, v8, v10
953 ; CHECK-NEXT: vsetvli zero, zero, e64, m4, ta, ma
954 ; CHECK-NEXT: vfmv.f.s fa0, v8
956 %v = load <8 x float>, ptr %x
957 %e = fpext <8 x float> %v to <8 x double>
958 %red = call reassoc double @llvm.vector.reduce.fadd.v8f64(double %s, <8 x double> %e)
962 define double @vreduce_ord_fwadd_v8f64(ptr %x, double %s) {
963 ; CHECK-LABEL: vreduce_ord_fwadd_v8f64:
965 ; CHECK-NEXT: vsetivli zero, 8, e64, m4, ta, ma
966 ; CHECK-NEXT: vle32.v v8, (a0)
967 ; CHECK-NEXT: vfmv.s.f v10, fa0
968 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, ma
969 ; CHECK-NEXT: vfwredosum.vs v8, v8, v10
970 ; CHECK-NEXT: vsetvli zero, zero, e64, m4, ta, ma
971 ; CHECK-NEXT: vfmv.f.s fa0, v8
973 %v = load <8 x float>, ptr %x
974 %e = fpext <8 x float> %v to <8 x double>
975 %red = call double @llvm.vector.reduce.fadd.v8f64(double %s, <8 x double> %e)
979 declare double @llvm.vector.reduce.fadd.v16f64(double, <16 x double>)
981 define double @vreduce_fadd_v16f64(ptr %x, double %s) {
982 ; CHECK-LABEL: vreduce_fadd_v16f64:
984 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
985 ; CHECK-NEXT: vle64.v v8, (a0)
986 ; CHECK-NEXT: vfmv.s.f v16, fa0
987 ; CHECK-NEXT: vfredusum.vs v8, v8, v16
988 ; CHECK-NEXT: vfmv.f.s fa0, v8
990 %v = load <16 x double>, ptr %x
991 %red = call reassoc double @llvm.vector.reduce.fadd.v16f64(double %s, <16 x double> %v)
995 define double @vreduce_ord_fadd_v16f64(ptr %x, double %s) {
996 ; CHECK-LABEL: vreduce_ord_fadd_v16f64:
998 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
999 ; CHECK-NEXT: vle64.v v8, (a0)
1000 ; CHECK-NEXT: vfmv.s.f v16, fa0
1001 ; CHECK-NEXT: vfredosum.vs v8, v8, v16
1002 ; CHECK-NEXT: vfmv.f.s fa0, v8
1004 %v = load <16 x double>, ptr %x
1005 %red = call double @llvm.vector.reduce.fadd.v16f64(double %s, <16 x double> %v)
1009 define double @vreduce_fwadd_v16f64(ptr %x, double %s) {
1010 ; CHECK-LABEL: vreduce_fwadd_v16f64:
1012 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
1013 ; CHECK-NEXT: vle32.v v8, (a0)
1014 ; CHECK-NEXT: vfmv.s.f v12, fa0
1015 ; CHECK-NEXT: vsetvli zero, zero, e32, m4, ta, ma
1016 ; CHECK-NEXT: vfwredusum.vs v8, v8, v12
1017 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, ma
1018 ; CHECK-NEXT: vfmv.f.s fa0, v8
1020 %v = load <16 x float>, ptr %x
1021 %e = fpext <16 x float> %v to <16 x double>
1022 %red = call reassoc double @llvm.vector.reduce.fadd.v16f64(double %s, <16 x double> %e)
1026 define double @vreduce_ord_fwadd_v16f64(ptr %x, double %s) {
1027 ; CHECK-LABEL: vreduce_ord_fwadd_v16f64:
1029 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
1030 ; CHECK-NEXT: vle32.v v8, (a0)
1031 ; CHECK-NEXT: vfmv.s.f v12, fa0
1032 ; CHECK-NEXT: vsetvli zero, zero, e32, m4, ta, ma
1033 ; CHECK-NEXT: vfwredosum.vs v8, v8, v12
1034 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, ma
1035 ; CHECK-NEXT: vfmv.f.s fa0, v8
1037 %v = load <16 x float>, ptr %x
1038 %e = fpext <16 x float> %v to <16 x double>
1039 %red = call double @llvm.vector.reduce.fadd.v16f64(double %s, <16 x double> %e)
1043 declare double @llvm.vector.reduce.fadd.v32f64(double, <32 x double>)
1045 define double @vreduce_fadd_v32f64(ptr %x, double %s) {
1046 ; CHECK-LABEL: vreduce_fadd_v32f64:
1048 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
1049 ; CHECK-NEXT: vle64.v v8, (a0)
1050 ; CHECK-NEXT: addi a0, a0, 128
1051 ; CHECK-NEXT: vle64.v v16, (a0)
1052 ; CHECK-NEXT: vfadd.vv v8, v8, v16
1053 ; CHECK-NEXT: vfmv.s.f v16, fa0
1054 ; CHECK-NEXT: vfredusum.vs v8, v8, v16
1055 ; CHECK-NEXT: vfmv.f.s fa0, v8
1057 %v = load <32 x double>, ptr %x
1058 %red = call reassoc double @llvm.vector.reduce.fadd.v32f64(double %s, <32 x double> %v)
1062 define double @vreduce_ord_fadd_v32f64(ptr %x, double %s) {
1063 ; CHECK-LABEL: vreduce_ord_fadd_v32f64:
1065 ; CHECK-NEXT: addi a1, a0, 128
1066 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
1067 ; CHECK-NEXT: vle64.v v8, (a0)
1068 ; CHECK-NEXT: vle64.v v16, (a1)
1069 ; CHECK-NEXT: vfmv.s.f v24, fa0
1070 ; CHECK-NEXT: vfredosum.vs v8, v8, v24
1071 ; CHECK-NEXT: vfredosum.vs v8, v16, v8
1072 ; CHECK-NEXT: vfmv.f.s fa0, v8
1074 %v = load <32 x double>, ptr %x
1075 %red = call double @llvm.vector.reduce.fadd.v32f64(double %s, <32 x double> %v)
1079 define double @vreduce_fwadd_v32f64(ptr %x, double %s) {
1080 ; CHECK-LABEL: vreduce_fwadd_v32f64:
1082 ; CHECK-NEXT: li a1, 32
1083 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
1084 ; CHECK-NEXT: vle32.v v8, (a0)
1085 ; CHECK-NEXT: vsetivli zero, 16, e32, m8, ta, ma
1086 ; CHECK-NEXT: vslidedown.vi v16, v8, 16
1087 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
1088 ; CHECK-NEXT: vfwadd.vv v24, v8, v16
1089 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, ma
1090 ; CHECK-NEXT: vfmv.s.f v8, fa0
1091 ; CHECK-NEXT: vfredusum.vs v8, v24, v8
1092 ; CHECK-NEXT: vfmv.f.s fa0, v8
1094 %v = load <32 x float>, ptr %x
1095 %e = fpext <32 x float> %v to <32 x double>
1096 %red = call reassoc double @llvm.vector.reduce.fadd.v32f64(double %s, <32 x double> %e)
1100 define double @vreduce_ord_fwadd_v32f64(ptr %x, double %s) {
1101 ; CHECK-LABEL: vreduce_ord_fwadd_v32f64:
1103 ; CHECK-NEXT: li a1, 32
1104 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
1105 ; CHECK-NEXT: vle32.v v8, (a0)
1106 ; CHECK-NEXT: vsetivli zero, 16, e32, m8, ta, ma
1107 ; CHECK-NEXT: vslidedown.vi v16, v8, 16
1108 ; CHECK-NEXT: vsetivli zero, 16, e64, m1, ta, ma
1109 ; CHECK-NEXT: vfmv.s.f v12, fa0
1110 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
1111 ; CHECK-NEXT: vfwredosum.vs v8, v8, v12
1112 ; CHECK-NEXT: vfwredosum.vs v8, v16, v8
1113 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, ma
1114 ; CHECK-NEXT: vfmv.f.s fa0, v8
1116 %v = load <32 x float>, ptr %x
1117 %e = fpext <32 x float> %v to <32 x double>
1118 %red = call double @llvm.vector.reduce.fadd.v32f64(double %s, <32 x double> %e)
1122 declare half @llvm.vector.reduce.fmin.v2f16(<2 x half>)
1124 define half @vreduce_fmin_v2f16(ptr %x) {
1125 ; CHECK-LABEL: vreduce_fmin_v2f16:
1127 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
1128 ; CHECK-NEXT: vle16.v v8, (a0)
1129 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1130 ; CHECK-NEXT: vfmv.f.s fa0, v8
1132 %v = load <2 x half>, ptr %x
1133 %red = call half @llvm.vector.reduce.fmin.v2f16(<2 x half> %v)
1137 declare half @llvm.vector.reduce.fmin.v4f16(<4 x half>)
1139 define half @vreduce_fmin_v4f16(ptr %x) {
1140 ; CHECK-LABEL: vreduce_fmin_v4f16:
1142 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
1143 ; CHECK-NEXT: vle16.v v8, (a0)
1144 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1145 ; CHECK-NEXT: vfmv.f.s fa0, v8
1147 %v = load <4 x half>, ptr %x
1148 %red = call half @llvm.vector.reduce.fmin.v4f16(<4 x half> %v)
1152 define half @vreduce_fmin_v4f16_nonans(ptr %x) {
1153 ; CHECK-LABEL: vreduce_fmin_v4f16_nonans:
1155 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
1156 ; CHECK-NEXT: vle16.v v8, (a0)
1157 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1158 ; CHECK-NEXT: vfmv.f.s fa0, v8
1160 %v = load <4 x half>, ptr %x
1161 %red = call nnan half @llvm.vector.reduce.fmin.v4f16(<4 x half> %v)
1165 define half @vreduce_fmin_v4f16_nonans_noinfs(ptr %x) {
1166 ; CHECK-LABEL: vreduce_fmin_v4f16_nonans_noinfs:
1168 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
1169 ; CHECK-NEXT: vle16.v v8, (a0)
1170 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1171 ; CHECK-NEXT: vfmv.f.s fa0, v8
1173 %v = load <4 x half>, ptr %x
1174 %red = call nnan ninf half @llvm.vector.reduce.fmin.v4f16(<4 x half> %v)
1178 declare half @llvm.vector.reduce.fmin.v128f16(<128 x half>)
1180 define half @vreduce_fmin_v128f16(ptr %x) {
1181 ; CHECK-LABEL: vreduce_fmin_v128f16:
1183 ; CHECK-NEXT: li a1, 64
1184 ; CHECK-NEXT: vsetvli zero, a1, e16, m8, ta, ma
1185 ; CHECK-NEXT: vle16.v v8, (a0)
1186 ; CHECK-NEXT: addi a0, a0, 128
1187 ; CHECK-NEXT: vle16.v v16, (a0)
1188 ; CHECK-NEXT: vfmin.vv v8, v8, v16
1189 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1190 ; CHECK-NEXT: vfmv.f.s fa0, v8
1192 %v = load <128 x half>, ptr %x
1193 %red = call half @llvm.vector.reduce.fmin.v128f16(<128 x half> %v)
1197 declare float @llvm.vector.reduce.fmin.v2f32(<2 x float>)
1199 define float @vreduce_fmin_v2f32(ptr %x) {
1200 ; CHECK-LABEL: vreduce_fmin_v2f32:
1202 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
1203 ; CHECK-NEXT: vle32.v v8, (a0)
1204 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1205 ; CHECK-NEXT: vfmv.f.s fa0, v8
1207 %v = load <2 x float>, ptr %x
1208 %red = call float @llvm.vector.reduce.fmin.v2f32(<2 x float> %v)
1212 declare float @llvm.vector.reduce.fmin.v4f32(<4 x float>)
1214 define float @vreduce_fmin_v4f32(ptr %x) {
1215 ; CHECK-LABEL: vreduce_fmin_v4f32:
1217 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1218 ; CHECK-NEXT: vle32.v v8, (a0)
1219 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1220 ; CHECK-NEXT: vfmv.f.s fa0, v8
1222 %v = load <4 x float>, ptr %x
1223 %red = call float @llvm.vector.reduce.fmin.v4f32(<4 x float> %v)
1227 define float @vreduce_fmin_v4f32_nonans(ptr %x) {
1228 ; CHECK-LABEL: vreduce_fmin_v4f32_nonans:
1230 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1231 ; CHECK-NEXT: vle32.v v8, (a0)
1232 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1233 ; CHECK-NEXT: vfmv.f.s fa0, v8
1235 %v = load <4 x float>, ptr %x
1236 %red = call nnan float @llvm.vector.reduce.fmin.v4f32(<4 x float> %v)
1240 define float @vreduce_fmin_v4f32_nonans_noinfs(ptr %x) {
1241 ; CHECK-LABEL: vreduce_fmin_v4f32_nonans_noinfs:
1243 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1244 ; CHECK-NEXT: vle32.v v8, (a0)
1245 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1246 ; CHECK-NEXT: vfmv.f.s fa0, v8
1248 %v = load <4 x float>, ptr %x
1249 %red = call nnan ninf float @llvm.vector.reduce.fmin.v4f32(<4 x float> %v)
1253 declare float @llvm.vector.reduce.fmin.v128f32(<128 x float>)
1255 define float @vreduce_fmin_v128f32(ptr %x) {
1256 ; CHECK-LABEL: vreduce_fmin_v128f32:
1258 ; CHECK-NEXT: li a1, 32
1259 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
1260 ; CHECK-NEXT: vle32.v v8, (a0)
1261 ; CHECK-NEXT: addi a1, a0, 384
1262 ; CHECK-NEXT: vle32.v v16, (a1)
1263 ; CHECK-NEXT: addi a1, a0, 256
1264 ; CHECK-NEXT: addi a0, a0, 128
1265 ; CHECK-NEXT: vle32.v v24, (a0)
1266 ; CHECK-NEXT: vle32.v v0, (a1)
1267 ; CHECK-NEXT: vfmin.vv v16, v24, v16
1268 ; CHECK-NEXT: vfmin.vv v8, v8, v0
1269 ; CHECK-NEXT: vfmin.vv v8, v8, v16
1270 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1271 ; CHECK-NEXT: vfmv.f.s fa0, v8
1273 %v = load <128 x float>, ptr %x
1274 %red = call float @llvm.vector.reduce.fmin.v128f32(<128 x float> %v)
1278 declare double @llvm.vector.reduce.fmin.v2f64(<2 x double>)
1280 define double @vreduce_fmin_v2f64(ptr %x) {
1281 ; CHECK-LABEL: vreduce_fmin_v2f64:
1283 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1284 ; CHECK-NEXT: vle64.v v8, (a0)
1285 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1286 ; CHECK-NEXT: vfmv.f.s fa0, v8
1288 %v = load <2 x double>, ptr %x
1289 %red = call double @llvm.vector.reduce.fmin.v2f64(<2 x double> %v)
1293 declare double @llvm.vector.reduce.fmin.v4f64(<4 x double>)
1295 define double @vreduce_fmin_v4f64(ptr %x) {
1296 ; CHECK-LABEL: vreduce_fmin_v4f64:
1298 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1299 ; CHECK-NEXT: vle64.v v8, (a0)
1300 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1301 ; CHECK-NEXT: vfmv.f.s fa0, v8
1303 %v = load <4 x double>, ptr %x
1304 %red = call double @llvm.vector.reduce.fmin.v4f64(<4 x double> %v)
1308 define double @vreduce_fmin_v4f64_nonans(ptr %x) {
1309 ; CHECK-LABEL: vreduce_fmin_v4f64_nonans:
1311 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1312 ; CHECK-NEXT: vle64.v v8, (a0)
1313 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1314 ; CHECK-NEXT: vfmv.f.s fa0, v8
1316 %v = load <4 x double>, ptr %x
1317 %red = call nnan double @llvm.vector.reduce.fmin.v4f64(<4 x double> %v)
1321 define double @vreduce_fmin_v4f64_nonans_noinfs(ptr %x) {
1322 ; CHECK-LABEL: vreduce_fmin_v4f64_nonans_noinfs:
1324 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1325 ; CHECK-NEXT: vle64.v v8, (a0)
1326 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1327 ; CHECK-NEXT: vfmv.f.s fa0, v8
1329 %v = load <4 x double>, ptr %x
1330 %red = call nnan ninf double @llvm.vector.reduce.fmin.v4f64(<4 x double> %v)
1334 declare double @llvm.vector.reduce.fmin.v32f64(<32 x double>)
1336 define double @vreduce_fmin_v32f64(ptr %x) {
1337 ; CHECK-LABEL: vreduce_fmin_v32f64:
1339 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
1340 ; CHECK-NEXT: vle64.v v8, (a0)
1341 ; CHECK-NEXT: addi a0, a0, 128
1342 ; CHECK-NEXT: vle64.v v16, (a0)
1343 ; CHECK-NEXT: vfmin.vv v8, v8, v16
1344 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1345 ; CHECK-NEXT: vfmv.f.s fa0, v8
1347 %v = load <32 x double>, ptr %x
1348 %red = call double @llvm.vector.reduce.fmin.v32f64(<32 x double> %v)
1352 declare half @llvm.vector.reduce.fmax.v2f16(<2 x half>)
1354 define half @vreduce_fmax_v2f16(ptr %x) {
1355 ; CHECK-LABEL: vreduce_fmax_v2f16:
1357 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
1358 ; CHECK-NEXT: vle16.v v8, (a0)
1359 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
1360 ; CHECK-NEXT: vfmv.f.s fa0, v8
1362 %v = load <2 x half>, ptr %x
1363 %red = call half @llvm.vector.reduce.fmax.v2f16(<2 x half> %v)
1367 declare half @llvm.vector.reduce.fmax.v4f16(<4 x half>)
1369 define half @vreduce_fmax_v4f16(ptr %x) {
1370 ; CHECK-LABEL: vreduce_fmax_v4f16:
1372 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
1373 ; CHECK-NEXT: vle16.v v8, (a0)
1374 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
1375 ; CHECK-NEXT: vfmv.f.s fa0, v8
1377 %v = load <4 x half>, ptr %x
1378 %red = call half @llvm.vector.reduce.fmax.v4f16(<4 x half> %v)
1382 define half @vreduce_fmax_v4f16_nonans(ptr %x) {
1383 ; CHECK-LABEL: vreduce_fmax_v4f16_nonans:
1385 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
1386 ; CHECK-NEXT: vle16.v v8, (a0)
1387 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
1388 ; CHECK-NEXT: vfmv.f.s fa0, v8
1390 %v = load <4 x half>, ptr %x
1391 %red = call nnan half @llvm.vector.reduce.fmax.v4f16(<4 x half> %v)
1395 define half @vreduce_fmax_v4f16_nonans_noinfs(ptr %x) {
1396 ; CHECK-LABEL: vreduce_fmax_v4f16_nonans_noinfs:
1398 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
1399 ; CHECK-NEXT: vle16.v v8, (a0)
1400 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
1401 ; CHECK-NEXT: vfmv.f.s fa0, v8
1403 %v = load <4 x half>, ptr %x
1404 %red = call nnan ninf half @llvm.vector.reduce.fmax.v4f16(<4 x half> %v)
1408 declare half @llvm.vector.reduce.fmax.v128f16(<128 x half>)
1410 define half @vreduce_fmax_v128f16(ptr %x) {
1411 ; CHECK-LABEL: vreduce_fmax_v128f16:
1413 ; CHECK-NEXT: li a1, 64
1414 ; CHECK-NEXT: vsetvli zero, a1, e16, m8, ta, ma
1415 ; CHECK-NEXT: vle16.v v8, (a0)
1416 ; CHECK-NEXT: addi a0, a0, 128
1417 ; CHECK-NEXT: vle16.v v16, (a0)
1418 ; CHECK-NEXT: vfmax.vv v8, v8, v16
1419 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
1420 ; CHECK-NEXT: vfmv.f.s fa0, v8
1422 %v = load <128 x half>, ptr %x
1423 %red = call half @llvm.vector.reduce.fmax.v128f16(<128 x half> %v)
1427 declare float @llvm.vector.reduce.fmax.v2f32(<2 x float>)
1429 define float @vreduce_fmax_v2f32(ptr %x) {
1430 ; CHECK-LABEL: vreduce_fmax_v2f32:
1432 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
1433 ; CHECK-NEXT: vle32.v v8, (a0)
1434 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
1435 ; CHECK-NEXT: vfmv.f.s fa0, v8
1437 %v = load <2 x float>, ptr %x
1438 %red = call float @llvm.vector.reduce.fmax.v2f32(<2 x float> %v)
1442 declare float @llvm.vector.reduce.fmax.v4f32(<4 x float>)
1444 define float @vreduce_fmax_v4f32(ptr %x) {
1445 ; CHECK-LABEL: vreduce_fmax_v4f32:
1447 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1448 ; CHECK-NEXT: vle32.v v8, (a0)
1449 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
1450 ; CHECK-NEXT: vfmv.f.s fa0, v8
1452 %v = load <4 x float>, ptr %x
1453 %red = call float @llvm.vector.reduce.fmax.v4f32(<4 x float> %v)
1457 define float @vreduce_fmax_v4f32_nonans(ptr %x) {
1458 ; CHECK-LABEL: vreduce_fmax_v4f32_nonans:
1460 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1461 ; CHECK-NEXT: vle32.v v8, (a0)
1462 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
1463 ; CHECK-NEXT: vfmv.f.s fa0, v8
1465 %v = load <4 x float>, ptr %x
1466 %red = call nnan float @llvm.vector.reduce.fmax.v4f32(<4 x float> %v)
1470 define float @vreduce_fmax_v4f32_nonans_noinfs(ptr %x) {
1471 ; CHECK-LABEL: vreduce_fmax_v4f32_nonans_noinfs:
1473 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1474 ; CHECK-NEXT: vle32.v v8, (a0)
1475 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
1476 ; CHECK-NEXT: vfmv.f.s fa0, v8
1478 %v = load <4 x float>, ptr %x
1479 %red = call nnan ninf float @llvm.vector.reduce.fmax.v4f32(<4 x float> %v)
1483 declare float @llvm.vector.reduce.fmax.v128f32(<128 x float>)
1485 define float @vreduce_fmax_v128f32(ptr %x) {
1486 ; CHECK-LABEL: vreduce_fmax_v128f32:
1488 ; CHECK-NEXT: li a1, 32
1489 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
1490 ; CHECK-NEXT: vle32.v v8, (a0)
1491 ; CHECK-NEXT: addi a1, a0, 384
1492 ; CHECK-NEXT: vle32.v v16, (a1)
1493 ; CHECK-NEXT: addi a1, a0, 256
1494 ; CHECK-NEXT: addi a0, a0, 128
1495 ; CHECK-NEXT: vle32.v v24, (a0)
1496 ; CHECK-NEXT: vle32.v v0, (a1)
1497 ; CHECK-NEXT: vfmax.vv v16, v24, v16
1498 ; CHECK-NEXT: vfmax.vv v8, v8, v0
1499 ; CHECK-NEXT: vfmax.vv v8, v8, v16
1500 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
1501 ; CHECK-NEXT: vfmv.f.s fa0, v8
1503 %v = load <128 x float>, ptr %x
1504 %red = call float @llvm.vector.reduce.fmax.v128f32(<128 x float> %v)
1508 declare double @llvm.vector.reduce.fmax.v2f64(<2 x double>)
1510 define double @vreduce_fmax_v2f64(ptr %x) {
1511 ; CHECK-LABEL: vreduce_fmax_v2f64:
1513 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1514 ; CHECK-NEXT: vle64.v v8, (a0)
1515 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
1516 ; CHECK-NEXT: vfmv.f.s fa0, v8
1518 %v = load <2 x double>, ptr %x
1519 %red = call double @llvm.vector.reduce.fmax.v2f64(<2 x double> %v)
1523 declare double @llvm.vector.reduce.fmax.v4f64(<4 x double>)
1525 define double @vreduce_fmax_v4f64(ptr %x) {
1526 ; CHECK-LABEL: vreduce_fmax_v4f64:
1528 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1529 ; CHECK-NEXT: vle64.v v8, (a0)
1530 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
1531 ; CHECK-NEXT: vfmv.f.s fa0, v8
1533 %v = load <4 x double>, ptr %x
1534 %red = call double @llvm.vector.reduce.fmax.v4f64(<4 x double> %v)
1538 define double @vreduce_fmax_v4f64_nonans(ptr %x) {
1539 ; CHECK-LABEL: vreduce_fmax_v4f64_nonans:
1541 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1542 ; CHECK-NEXT: vle64.v v8, (a0)
1543 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
1544 ; CHECK-NEXT: vfmv.f.s fa0, v8
1546 %v = load <4 x double>, ptr %x
1547 %red = call nnan double @llvm.vector.reduce.fmax.v4f64(<4 x double> %v)
1551 define double @vreduce_fmax_v4f64_nonans_noinfs(ptr %x) {
1552 ; CHECK-LABEL: vreduce_fmax_v4f64_nonans_noinfs:
1554 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1555 ; CHECK-NEXT: vle64.v v8, (a0)
1556 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
1557 ; CHECK-NEXT: vfmv.f.s fa0, v8
1559 %v = load <4 x double>, ptr %x
1560 %red = call nnan ninf double @llvm.vector.reduce.fmax.v4f64(<4 x double> %v)
1564 declare double @llvm.vector.reduce.fmax.v32f64(<32 x double>)
1566 define double @vreduce_fmax_v32f64(ptr %x) {
1567 ; CHECK-LABEL: vreduce_fmax_v32f64:
1569 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
1570 ; CHECK-NEXT: vle64.v v8, (a0)
1571 ; CHECK-NEXT: addi a0, a0, 128
1572 ; CHECK-NEXT: vle64.v v16, (a0)
1573 ; CHECK-NEXT: vfmax.vv v8, v8, v16
1574 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
1575 ; CHECK-NEXT: vfmv.f.s fa0, v8
1577 %v = load <32 x double>, ptr %x
1578 %red = call double @llvm.vector.reduce.fmax.v32f64(<32 x double> %v)
1582 define float @vreduce_nsz_fadd_v4f32(ptr %x, float %s) {
1583 ; CHECK-LABEL: vreduce_nsz_fadd_v4f32:
1585 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1586 ; CHECK-NEXT: vle32.v v8, (a0)
1587 ; CHECK-NEXT: vfmv.s.f v9, fa0
1588 ; CHECK-NEXT: vfredusum.vs v8, v8, v9
1589 ; CHECK-NEXT: vfmv.f.s fa0, v8
1591 %v = load <4 x float>, ptr %x
1592 %red = call reassoc nsz float @llvm.vector.reduce.fadd.v4f32(float %s, <4 x float> %v)
1596 declare float @llvm.vector.reduce.fminimum.v2f32(<2 x float>)
1598 define float @vreduce_fminimum_v2f32(ptr %x) {
1599 ; CHECK-LABEL: vreduce_fminimum_v2f32:
1601 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
1602 ; CHECK-NEXT: vle32.v v8, (a0)
1603 ; CHECK-NEXT: vmfne.vv v9, v8, v8
1604 ; CHECK-NEXT: vcpop.m a0, v9
1605 ; CHECK-NEXT: beqz a0, .LBB99_2
1606 ; CHECK-NEXT: # %bb.1:
1607 ; CHECK-NEXT: lui a0, 523264
1608 ; CHECK-NEXT: fmv.w.x fa0, a0
1610 ; CHECK-NEXT: .LBB99_2:
1611 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1612 ; CHECK-NEXT: vfmv.f.s fa0, v8
1614 %v = load <2 x float>, ptr %x
1615 %red = call float @llvm.vector.reduce.fminimum.v2f32(<2 x float> %v)
1619 define float @vreduce_fminimum_v2f32_nonans(ptr %x) {
1620 ; CHECK-LABEL: vreduce_fminimum_v2f32_nonans:
1622 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
1623 ; CHECK-NEXT: vle32.v v8, (a0)
1624 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1625 ; CHECK-NEXT: vfmv.f.s fa0, v8
1627 %v = load <2 x float>, ptr %x
1628 %red = call nnan float @llvm.vector.reduce.fminimum.v2f32(<2 x float> %v)
1632 declare float @llvm.vector.reduce.fminimum.v4f32(<4 x float>)
1634 define float @vreduce_fminimum_v4f32(ptr %x) {
1635 ; CHECK-LABEL: vreduce_fminimum_v4f32:
1637 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1638 ; CHECK-NEXT: vle32.v v8, (a0)
1639 ; CHECK-NEXT: vmfne.vv v9, v8, v8
1640 ; CHECK-NEXT: vcpop.m a0, v9
1641 ; CHECK-NEXT: beqz a0, .LBB101_2
1642 ; CHECK-NEXT: # %bb.1:
1643 ; CHECK-NEXT: lui a0, 523264
1644 ; CHECK-NEXT: fmv.w.x fa0, a0
1646 ; CHECK-NEXT: .LBB101_2:
1647 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1648 ; CHECK-NEXT: vfmv.f.s fa0, v8
1650 %v = load <4 x float>, ptr %x
1651 %red = call float @llvm.vector.reduce.fminimum.v4f32(<4 x float> %v)
1655 define float @vreduce_fminimum_v4f32_nonans(ptr %x) {
1656 ; CHECK-LABEL: vreduce_fminimum_v4f32_nonans:
1658 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
1659 ; CHECK-NEXT: vle32.v v8, (a0)
1660 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1661 ; CHECK-NEXT: vfmv.f.s fa0, v8
1663 %v = load <4 x float>, ptr %x
1664 %red = call nnan float @llvm.vector.reduce.fminimum.v4f32(<4 x float> %v)
1668 declare float @llvm.vector.reduce.fminimum.v8f32(<8 x float>)
1670 define float @vreduce_fminimum_v8f32(ptr %x) {
1671 ; CHECK-LABEL: vreduce_fminimum_v8f32:
1673 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
1674 ; CHECK-NEXT: vle32.v v8, (a0)
1675 ; CHECK-NEXT: vmfne.vv v10, v8, v8
1676 ; CHECK-NEXT: vcpop.m a0, v10
1677 ; CHECK-NEXT: beqz a0, .LBB103_2
1678 ; CHECK-NEXT: # %bb.1:
1679 ; CHECK-NEXT: lui a0, 523264
1680 ; CHECK-NEXT: fmv.w.x fa0, a0
1682 ; CHECK-NEXT: .LBB103_2:
1683 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1684 ; CHECK-NEXT: vfmv.f.s fa0, v8
1686 %v = load <8 x float>, ptr %x
1687 %red = call float @llvm.vector.reduce.fminimum.v8f32(<8 x float> %v)
1691 define float @vreduce_fminimum_v8f32_nonans(ptr %x) {
1692 ; CHECK-LABEL: vreduce_fminimum_v8f32_nonans:
1694 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
1695 ; CHECK-NEXT: vle32.v v8, (a0)
1696 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1697 ; CHECK-NEXT: vfmv.f.s fa0, v8
1699 %v = load <8 x float>, ptr %x
1700 %red = call nnan float @llvm.vector.reduce.fminimum.v8f32(<8 x float> %v)
1704 declare float @llvm.vector.reduce.fminimum.v16f32(<16 x float>)
1706 define float @vreduce_fminimum_v16f32(ptr %x) {
1707 ; CHECK-LABEL: vreduce_fminimum_v16f32:
1709 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
1710 ; CHECK-NEXT: vle32.v v8, (a0)
1711 ; CHECK-NEXT: vmfne.vv v12, v8, v8
1712 ; CHECK-NEXT: vcpop.m a0, v12
1713 ; CHECK-NEXT: beqz a0, .LBB105_2
1714 ; CHECK-NEXT: # %bb.1:
1715 ; CHECK-NEXT: lui a0, 523264
1716 ; CHECK-NEXT: fmv.w.x fa0, a0
1718 ; CHECK-NEXT: .LBB105_2:
1719 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1720 ; CHECK-NEXT: vfmv.f.s fa0, v8
1722 %v = load <16 x float>, ptr %x
1723 %red = call float @llvm.vector.reduce.fminimum.v16f32(<16 x float> %v)
1727 define float @vreduce_fminimum_v16f32_nonans(ptr %x) {
1728 ; CHECK-LABEL: vreduce_fminimum_v16f32_nonans:
1730 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
1731 ; CHECK-NEXT: vle32.v v8, (a0)
1732 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1733 ; CHECK-NEXT: vfmv.f.s fa0, v8
1735 %v = load <16 x float>, ptr %x
1736 %red = call nnan float @llvm.vector.reduce.fminimum.v16f32(<16 x float> %v)
1740 declare float @llvm.vector.reduce.fminimum.v32f32(<32 x float>)
1742 define float @vreduce_fminimum_v32f32(ptr %x) {
1743 ; CHECK-LABEL: vreduce_fminimum_v32f32:
1745 ; CHECK-NEXT: li a1, 32
1746 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
1747 ; CHECK-NEXT: vle32.v v8, (a0)
1748 ; CHECK-NEXT: vmfne.vv v16, v8, v8
1749 ; CHECK-NEXT: vcpop.m a0, v16
1750 ; CHECK-NEXT: beqz a0, .LBB107_2
1751 ; CHECK-NEXT: # %bb.1:
1752 ; CHECK-NEXT: lui a0, 523264
1753 ; CHECK-NEXT: fmv.w.x fa0, a0
1755 ; CHECK-NEXT: .LBB107_2:
1756 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1757 ; CHECK-NEXT: vfmv.f.s fa0, v8
1759 %v = load <32 x float>, ptr %x
1760 %red = call float @llvm.vector.reduce.fminimum.v32f32(<32 x float> %v)
1764 define float @vreduce_fminimum_v32f32_nonans(ptr %x) {
1765 ; CHECK-LABEL: vreduce_fminimum_v32f32_nonans:
1767 ; CHECK-NEXT: li a1, 32
1768 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
1769 ; CHECK-NEXT: vle32.v v8, (a0)
1770 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1771 ; CHECK-NEXT: vfmv.f.s fa0, v8
1773 %v = load <32 x float>, ptr %x
1774 %red = call nnan float @llvm.vector.reduce.fminimum.v32f32(<32 x float> %v)
1778 declare float @llvm.vector.reduce.fminimum.v64f32(<64 x float>)
1780 define float @vreduce_fminimum_v64f32(ptr %x) {
1781 ; CHECK-LABEL: vreduce_fminimum_v64f32:
1783 ; CHECK-NEXT: addi sp, sp, -16
1784 ; CHECK-NEXT: .cfi_def_cfa_offset 16
1785 ; CHECK-NEXT: csrr a1, vlenb
1786 ; CHECK-NEXT: slli a1, a1, 3
1787 ; CHECK-NEXT: sub sp, sp, a1
1788 ; CHECK-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x10, 0x22, 0x11, 0x08, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 16 + 8 * vlenb
1789 ; CHECK-NEXT: addi a1, a0, 128
1790 ; CHECK-NEXT: li a2, 32
1791 ; CHECK-NEXT: vsetvli zero, a2, e32, m8, ta, ma
1792 ; CHECK-NEXT: vle32.v v16, (a0)
1793 ; CHECK-NEXT: vle32.v v24, (a1)
1794 ; CHECK-NEXT: vmfeq.vv v0, v16, v16
1795 ; CHECK-NEXT: vmfeq.vv v7, v24, v24
1796 ; CHECK-NEXT: vmerge.vvm v8, v16, v24, v0
1797 ; CHECK-NEXT: addi a0, sp, 16
1798 ; CHECK-NEXT: vs8r.v v8, (a0) # Unknown-size Folded Spill
1799 ; CHECK-NEXT: vmv1r.v v0, v7
1800 ; CHECK-NEXT: vmerge.vvm v8, v24, v16, v0
1801 ; CHECK-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
1802 ; CHECK-NEXT: vfmin.vv v8, v8, v16
1803 ; CHECK-NEXT: vmfne.vv v16, v8, v8
1804 ; CHECK-NEXT: vcpop.m a0, v16
1805 ; CHECK-NEXT: beqz a0, .LBB109_2
1806 ; CHECK-NEXT: # %bb.1:
1807 ; CHECK-NEXT: lui a0, 523264
1808 ; CHECK-NEXT: fmv.w.x fa0, a0
1809 ; CHECK-NEXT: j .LBB109_3
1810 ; CHECK-NEXT: .LBB109_2:
1811 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1812 ; CHECK-NEXT: vfmv.f.s fa0, v8
1813 ; CHECK-NEXT: .LBB109_3:
1814 ; CHECK-NEXT: csrr a0, vlenb
1815 ; CHECK-NEXT: slli a0, a0, 3
1816 ; CHECK-NEXT: add sp, sp, a0
1817 ; CHECK-NEXT: addi sp, sp, 16
1819 %v = load <64 x float>, ptr %x
1820 %red = call float @llvm.vector.reduce.fminimum.v64f32(<64 x float> %v)
1824 define float @vreduce_fminimum_v64f32_nonans(ptr %x) {
1825 ; CHECK-LABEL: vreduce_fminimum_v64f32_nonans:
1827 ; CHECK-NEXT: li a1, 32
1828 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
1829 ; CHECK-NEXT: vle32.v v8, (a0)
1830 ; CHECK-NEXT: addi a0, a0, 128
1831 ; CHECK-NEXT: vle32.v v16, (a0)
1832 ; CHECK-NEXT: vfmin.vv v8, v8, v16
1833 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1834 ; CHECK-NEXT: vfmv.f.s fa0, v8
1836 %v = load <64 x float>, ptr %x
1837 %red = call nnan float @llvm.vector.reduce.fminimum.v64f32(<64 x float> %v)
1841 declare float @llvm.vector.reduce.fminimum.v128f32(<128 x float>)
1843 define float @vreduce_fminimum_v128f32(ptr %x) {
1844 ; CHECK-LABEL: vreduce_fminimum_v128f32:
1846 ; CHECK-NEXT: addi sp, sp, -16
1847 ; CHECK-NEXT: .cfi_def_cfa_offset 16
1848 ; CHECK-NEXT: csrr a1, vlenb
1849 ; CHECK-NEXT: slli a1, a1, 3
1850 ; CHECK-NEXT: mv a2, a1
1851 ; CHECK-NEXT: slli a1, a1, 1
1852 ; CHECK-NEXT: add a1, a1, a2
1853 ; CHECK-NEXT: sub sp, sp, a1
1854 ; CHECK-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x10, 0x22, 0x11, 0x18, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 16 + 24 * vlenb
1855 ; CHECK-NEXT: li a1, 32
1856 ; CHECK-NEXT: addi a2, a0, 128
1857 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
1858 ; CHECK-NEXT: vle32.v v16, (a2)
1859 ; CHECK-NEXT: addi a1, a0, 384
1860 ; CHECK-NEXT: vle32.v v8, (a1)
1861 ; CHECK-NEXT: addi a1, a0, 256
1862 ; CHECK-NEXT: vmfeq.vv v0, v16, v16
1863 ; CHECK-NEXT: vle32.v v24, (a0)
1864 ; CHECK-NEXT: csrr a0, vlenb
1865 ; CHECK-NEXT: slli a0, a0, 4
1866 ; CHECK-NEXT: add a0, sp, a0
1867 ; CHECK-NEXT: addi a0, a0, 16
1868 ; CHECK-NEXT: vs8r.v v24, (a0) # Unknown-size Folded Spill
1869 ; CHECK-NEXT: vmerge.vvm v24, v16, v8, v0
1870 ; CHECK-NEXT: csrr a0, vlenb
1871 ; CHECK-NEXT: slli a0, a0, 3
1872 ; CHECK-NEXT: add a0, sp, a0
1873 ; CHECK-NEXT: addi a0, a0, 16
1874 ; CHECK-NEXT: vs8r.v v24, (a0) # Unknown-size Folded Spill
1875 ; CHECK-NEXT: vmfeq.vv v0, v8, v8
1876 ; CHECK-NEXT: vle32.v v24, (a1)
1877 ; CHECK-NEXT: vmerge.vvm v8, v8, v16, v0
1878 ; CHECK-NEXT: csrr a0, vlenb
1879 ; CHECK-NEXT: slli a0, a0, 3
1880 ; CHECK-NEXT: add a0, sp, a0
1881 ; CHECK-NEXT: addi a0, a0, 16
1882 ; CHECK-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
1883 ; CHECK-NEXT: vfmin.vv v8, v8, v16
1884 ; CHECK-NEXT: addi a0, sp, 16
1885 ; CHECK-NEXT: vs8r.v v8, (a0) # Unknown-size Folded Spill
1886 ; CHECK-NEXT: csrr a0, vlenb
1887 ; CHECK-NEXT: slli a0, a0, 4
1888 ; CHECK-NEXT: add a0, sp, a0
1889 ; CHECK-NEXT: addi a0, a0, 16
1890 ; CHECK-NEXT: vl8r.v v8, (a0) # Unknown-size Folded Reload
1891 ; CHECK-NEXT: vmfeq.vv v0, v8, v8
1892 ; CHECK-NEXT: vmfeq.vv v7, v24, v24
1893 ; CHECK-NEXT: vmerge.vvm v16, v8, v24, v0
1894 ; CHECK-NEXT: csrr a0, vlenb
1895 ; CHECK-NEXT: slli a0, a0, 3
1896 ; CHECK-NEXT: add a0, sp, a0
1897 ; CHECK-NEXT: addi a0, a0, 16
1898 ; CHECK-NEXT: vs8r.v v16, (a0) # Unknown-size Folded Spill
1899 ; CHECK-NEXT: vmv1r.v v0, v7
1900 ; CHECK-NEXT: vmerge.vvm v24, v24, v8, v0
1901 ; CHECK-NEXT: csrr a0, vlenb
1902 ; CHECK-NEXT: slli a0, a0, 3
1903 ; CHECK-NEXT: add a0, sp, a0
1904 ; CHECK-NEXT: addi a0, a0, 16
1905 ; CHECK-NEXT: vl8r.v v8, (a0) # Unknown-size Folded Reload
1906 ; CHECK-NEXT: vfmin.vv v24, v24, v8
1907 ; CHECK-NEXT: vmfeq.vv v0, v24, v24
1908 ; CHECK-NEXT: addi a0, sp, 16
1909 ; CHECK-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
1910 ; CHECK-NEXT: vmfeq.vv v7, v16, v16
1911 ; CHECK-NEXT: vmerge.vvm v8, v24, v16, v0
1912 ; CHECK-NEXT: csrr a0, vlenb
1913 ; CHECK-NEXT: slli a0, a0, 4
1914 ; CHECK-NEXT: add a0, sp, a0
1915 ; CHECK-NEXT: addi a0, a0, 16
1916 ; CHECK-NEXT: vs8r.v v8, (a0) # Unknown-size Folded Spill
1917 ; CHECK-NEXT: vmv1r.v v0, v7
1918 ; CHECK-NEXT: vmerge.vvm v8, v16, v24, v0
1919 ; CHECK-NEXT: csrr a0, vlenb
1920 ; CHECK-NEXT: slli a0, a0, 4
1921 ; CHECK-NEXT: add a0, sp, a0
1922 ; CHECK-NEXT: addi a0, a0, 16
1923 ; CHECK-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
1924 ; CHECK-NEXT: vfmin.vv v8, v8, v16
1925 ; CHECK-NEXT: vmfne.vv v16, v8, v8
1926 ; CHECK-NEXT: vcpop.m a0, v16
1927 ; CHECK-NEXT: beqz a0, .LBB111_2
1928 ; CHECK-NEXT: # %bb.1:
1929 ; CHECK-NEXT: lui a0, 523264
1930 ; CHECK-NEXT: fmv.w.x fa0, a0
1931 ; CHECK-NEXT: j .LBB111_3
1932 ; CHECK-NEXT: .LBB111_2:
1933 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1934 ; CHECK-NEXT: vfmv.f.s fa0, v8
1935 ; CHECK-NEXT: .LBB111_3:
1936 ; CHECK-NEXT: csrr a0, vlenb
1937 ; CHECK-NEXT: slli a0, a0, 3
1938 ; CHECK-NEXT: mv a1, a0
1939 ; CHECK-NEXT: slli a0, a0, 1
1940 ; CHECK-NEXT: add a0, a0, a1
1941 ; CHECK-NEXT: add sp, sp, a0
1942 ; CHECK-NEXT: addi sp, sp, 16
1944 %v = load <128 x float>, ptr %x
1945 %red = call float @llvm.vector.reduce.fminimum.v128f32(<128 x float> %v)
1949 define float @vreduce_fminimum_v128f32_nonans(ptr %x) {
1950 ; CHECK-LABEL: vreduce_fminimum_v128f32_nonans:
1952 ; CHECK-NEXT: li a1, 32
1953 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
1954 ; CHECK-NEXT: vle32.v v8, (a0)
1955 ; CHECK-NEXT: addi a1, a0, 384
1956 ; CHECK-NEXT: vle32.v v16, (a1)
1957 ; CHECK-NEXT: addi a1, a0, 256
1958 ; CHECK-NEXT: addi a0, a0, 128
1959 ; CHECK-NEXT: vle32.v v24, (a0)
1960 ; CHECK-NEXT: vle32.v v0, (a1)
1961 ; CHECK-NEXT: vfmin.vv v16, v24, v16
1962 ; CHECK-NEXT: vfmin.vv v8, v8, v0
1963 ; CHECK-NEXT: vfmin.vv v8, v8, v16
1964 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1965 ; CHECK-NEXT: vfmv.f.s fa0, v8
1967 %v = load <128 x float>, ptr %x
1968 %red = call nnan float @llvm.vector.reduce.fminimum.v128f32(<128 x float> %v)
1972 declare double @llvm.vector.reduce.fminimum.v2f64(<2 x double>)
1974 define double @vreduce_fminimum_v2f64(ptr %x) {
1975 ; CHECK-LABEL: vreduce_fminimum_v2f64:
1977 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1978 ; CHECK-NEXT: vle64.v v8, (a0)
1979 ; CHECK-NEXT: vmfne.vv v9, v8, v8
1980 ; CHECK-NEXT: vcpop.m a0, v9
1981 ; CHECK-NEXT: beqz a0, .LBB113_2
1982 ; CHECK-NEXT: # %bb.1:
1983 ; CHECK-NEXT: lui a0, %hi(.LCPI113_0)
1984 ; CHECK-NEXT: fld fa0, %lo(.LCPI113_0)(a0)
1986 ; CHECK-NEXT: .LBB113_2:
1987 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
1988 ; CHECK-NEXT: vfmv.f.s fa0, v8
1990 %v = load <2 x double>, ptr %x
1991 %red = call double @llvm.vector.reduce.fminimum.v2f64(<2 x double> %v)
1995 define double @vreduce_fminimum_v2f64_nonans(ptr %x) {
1996 ; CHECK-LABEL: vreduce_fminimum_v2f64_nonans:
1998 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1999 ; CHECK-NEXT: vle64.v v8, (a0)
2000 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
2001 ; CHECK-NEXT: vfmv.f.s fa0, v8
2003 %v = load <2 x double>, ptr %x
2004 %red = call nnan double @llvm.vector.reduce.fminimum.v2f64(<2 x double> %v)
2008 declare double @llvm.vector.reduce.fminimum.v4f64(<4 x double>)
2010 define double @vreduce_fminimum_v4f64(ptr %x) {
2011 ; CHECK-LABEL: vreduce_fminimum_v4f64:
2013 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
2014 ; CHECK-NEXT: vle64.v v8, (a0)
2015 ; CHECK-NEXT: vmfne.vv v10, v8, v8
2016 ; CHECK-NEXT: vcpop.m a0, v10
2017 ; CHECK-NEXT: beqz a0, .LBB115_2
2018 ; CHECK-NEXT: # %bb.1:
2019 ; CHECK-NEXT: lui a0, %hi(.LCPI115_0)
2020 ; CHECK-NEXT: fld fa0, %lo(.LCPI115_0)(a0)
2022 ; CHECK-NEXT: .LBB115_2:
2023 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
2024 ; CHECK-NEXT: vfmv.f.s fa0, v8
2026 %v = load <4 x double>, ptr %x
2027 %red = call double @llvm.vector.reduce.fminimum.v4f64(<4 x double> %v)
2031 define double @vreduce_fminimum_v4f64_nonans(ptr %x) {
2032 ; CHECK-LABEL: vreduce_fminimum_v4f64_nonans:
2034 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
2035 ; CHECK-NEXT: vle64.v v8, (a0)
2036 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
2037 ; CHECK-NEXT: vfmv.f.s fa0, v8
2039 %v = load <4 x double>, ptr %x
2040 %red = call nnan double @llvm.vector.reduce.fminimum.v4f64(<4 x double> %v)
2044 declare double @llvm.vector.reduce.fminimum.v8f64(<8 x double>)
2046 define double @vreduce_fminimum_v8f64(ptr %x) {
2047 ; CHECK-LABEL: vreduce_fminimum_v8f64:
2049 ; CHECK-NEXT: vsetivli zero, 8, e64, m4, ta, ma
2050 ; CHECK-NEXT: vle64.v v8, (a0)
2051 ; CHECK-NEXT: vmfne.vv v12, v8, v8
2052 ; CHECK-NEXT: vcpop.m a0, v12
2053 ; CHECK-NEXT: beqz a0, .LBB117_2
2054 ; CHECK-NEXT: # %bb.1:
2055 ; CHECK-NEXT: lui a0, %hi(.LCPI117_0)
2056 ; CHECK-NEXT: fld fa0, %lo(.LCPI117_0)(a0)
2058 ; CHECK-NEXT: .LBB117_2:
2059 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
2060 ; CHECK-NEXT: vfmv.f.s fa0, v8
2062 %v = load <8 x double>, ptr %x
2063 %red = call double @llvm.vector.reduce.fminimum.v8f64(<8 x double> %v)
2067 define double @vreduce_fminimum_v8f64_nonans(ptr %x) {
2068 ; CHECK-LABEL: vreduce_fminimum_v8f64_nonans:
2070 ; CHECK-NEXT: vsetivli zero, 8, e64, m4, ta, ma
2071 ; CHECK-NEXT: vle64.v v8, (a0)
2072 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
2073 ; CHECK-NEXT: vfmv.f.s fa0, v8
2075 %v = load <8 x double>, ptr %x
2076 %red = call nnan double @llvm.vector.reduce.fminimum.v8f64(<8 x double> %v)
2080 declare double @llvm.vector.reduce.fminimum.v16f64(<16 x double>)
2082 define double @vreduce_fminimum_v16f64(ptr %x) {
2083 ; CHECK-LABEL: vreduce_fminimum_v16f64:
2085 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
2086 ; CHECK-NEXT: vle64.v v8, (a0)
2087 ; CHECK-NEXT: vmfne.vv v16, v8, v8
2088 ; CHECK-NEXT: vcpop.m a0, v16
2089 ; CHECK-NEXT: beqz a0, .LBB119_2
2090 ; CHECK-NEXT: # %bb.1:
2091 ; CHECK-NEXT: lui a0, %hi(.LCPI119_0)
2092 ; CHECK-NEXT: fld fa0, %lo(.LCPI119_0)(a0)
2094 ; CHECK-NEXT: .LBB119_2:
2095 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
2096 ; CHECK-NEXT: vfmv.f.s fa0, v8
2098 %v = load <16 x double>, ptr %x
2099 %red = call double @llvm.vector.reduce.fminimum.v16f64(<16 x double> %v)
2103 define double @vreduce_fminimum_v16f64_nonans(ptr %x) {
2104 ; CHECK-LABEL: vreduce_fminimum_v16f64_nonans:
2106 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
2107 ; CHECK-NEXT: vle64.v v8, (a0)
2108 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
2109 ; CHECK-NEXT: vfmv.f.s fa0, v8
2111 %v = load <16 x double>, ptr %x
2112 %red = call nnan double @llvm.vector.reduce.fminimum.v16f64(<16 x double> %v)
2116 declare double @llvm.vector.reduce.fminimum.v32f64(<32 x double>)
2118 define double @vreduce_fminimum_v32f64(ptr %x) {
2119 ; CHECK-LABEL: vreduce_fminimum_v32f64:
2121 ; CHECK-NEXT: addi sp, sp, -16
2122 ; CHECK-NEXT: .cfi_def_cfa_offset 16
2123 ; CHECK-NEXT: csrr a1, vlenb
2124 ; CHECK-NEXT: slli a1, a1, 3
2125 ; CHECK-NEXT: sub sp, sp, a1
2126 ; CHECK-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x10, 0x22, 0x11, 0x08, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 16 + 8 * vlenb
2127 ; CHECK-NEXT: addi a1, a0, 128
2128 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
2129 ; CHECK-NEXT: vle64.v v16, (a0)
2130 ; CHECK-NEXT: vle64.v v24, (a1)
2131 ; CHECK-NEXT: vmfeq.vv v0, v16, v16
2132 ; CHECK-NEXT: vmfeq.vv v7, v24, v24
2133 ; CHECK-NEXT: vmerge.vvm v8, v16, v24, v0
2134 ; CHECK-NEXT: addi a0, sp, 16
2135 ; CHECK-NEXT: vs8r.v v8, (a0) # Unknown-size Folded Spill
2136 ; CHECK-NEXT: vmv1r.v v0, v7
2137 ; CHECK-NEXT: vmerge.vvm v8, v24, v16, v0
2138 ; CHECK-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
2139 ; CHECK-NEXT: vfmin.vv v8, v8, v16
2140 ; CHECK-NEXT: vmfne.vv v16, v8, v8
2141 ; CHECK-NEXT: vcpop.m a0, v16
2142 ; CHECK-NEXT: beqz a0, .LBB121_2
2143 ; CHECK-NEXT: # %bb.1:
2144 ; CHECK-NEXT: lui a0, %hi(.LCPI121_0)
2145 ; CHECK-NEXT: fld fa0, %lo(.LCPI121_0)(a0)
2146 ; CHECK-NEXT: j .LBB121_3
2147 ; CHECK-NEXT: .LBB121_2:
2148 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
2149 ; CHECK-NEXT: vfmv.f.s fa0, v8
2150 ; CHECK-NEXT: .LBB121_3:
2151 ; CHECK-NEXT: csrr a0, vlenb
2152 ; CHECK-NEXT: slli a0, a0, 3
2153 ; CHECK-NEXT: add sp, sp, a0
2154 ; CHECK-NEXT: addi sp, sp, 16
2156 %v = load <32 x double>, ptr %x
2157 %red = call double @llvm.vector.reduce.fminimum.v32f64(<32 x double> %v)
2161 define double @vreduce_fminimum_v32f64_nonans(ptr %x) {
2162 ; CHECK-LABEL: vreduce_fminimum_v32f64_nonans:
2164 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
2165 ; CHECK-NEXT: vle64.v v8, (a0)
2166 ; CHECK-NEXT: addi a0, a0, 128
2167 ; CHECK-NEXT: vle64.v v16, (a0)
2168 ; CHECK-NEXT: vfmin.vv v8, v8, v16
2169 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
2170 ; CHECK-NEXT: vfmv.f.s fa0, v8
2172 %v = load <32 x double>, ptr %x
2173 %red = call nnan double @llvm.vector.reduce.fminimum.v32f64(<32 x double> %v)
2177 declare double @llvm.vector.reduce.fminimum.v64f64(<64 x double>)
2179 define double @vreduce_fminimum_v64f64(ptr %x) {
2180 ; CHECK-LABEL: vreduce_fminimum_v64f64:
2182 ; CHECK-NEXT: addi sp, sp, -16
2183 ; CHECK-NEXT: .cfi_def_cfa_offset 16
2184 ; CHECK-NEXT: csrr a1, vlenb
2185 ; CHECK-NEXT: slli a1, a1, 3
2186 ; CHECK-NEXT: mv a2, a1
2187 ; CHECK-NEXT: slli a1, a1, 1
2188 ; CHECK-NEXT: add a1, a1, a2
2189 ; CHECK-NEXT: sub sp, sp, a1
2190 ; CHECK-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x10, 0x22, 0x11, 0x18, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 16 + 24 * vlenb
2191 ; CHECK-NEXT: addi a1, a0, 128
2192 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
2193 ; CHECK-NEXT: vle64.v v16, (a1)
2194 ; CHECK-NEXT: addi a1, a0, 384
2195 ; CHECK-NEXT: vle64.v v8, (a1)
2196 ; CHECK-NEXT: addi a1, a0, 256
2197 ; CHECK-NEXT: vmfeq.vv v0, v16, v16
2198 ; CHECK-NEXT: vle64.v v24, (a0)
2199 ; CHECK-NEXT: csrr a0, vlenb
2200 ; CHECK-NEXT: slli a0, a0, 4
2201 ; CHECK-NEXT: add a0, sp, a0
2202 ; CHECK-NEXT: addi a0, a0, 16
2203 ; CHECK-NEXT: vs8r.v v24, (a0) # Unknown-size Folded Spill
2204 ; CHECK-NEXT: vmerge.vvm v24, v16, v8, v0
2205 ; CHECK-NEXT: csrr a0, vlenb
2206 ; CHECK-NEXT: slli a0, a0, 3
2207 ; CHECK-NEXT: add a0, sp, a0
2208 ; CHECK-NEXT: addi a0, a0, 16
2209 ; CHECK-NEXT: vs8r.v v24, (a0) # Unknown-size Folded Spill
2210 ; CHECK-NEXT: vmfeq.vv v0, v8, v8
2211 ; CHECK-NEXT: vle64.v v24, (a1)
2212 ; CHECK-NEXT: vmerge.vvm v8, v8, v16, v0
2213 ; CHECK-NEXT: csrr a0, vlenb
2214 ; CHECK-NEXT: slli a0, a0, 3
2215 ; CHECK-NEXT: add a0, sp, a0
2216 ; CHECK-NEXT: addi a0, a0, 16
2217 ; CHECK-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
2218 ; CHECK-NEXT: vfmin.vv v8, v8, v16
2219 ; CHECK-NEXT: addi a0, sp, 16
2220 ; CHECK-NEXT: vs8r.v v8, (a0) # Unknown-size Folded Spill
2221 ; CHECK-NEXT: csrr a0, vlenb
2222 ; CHECK-NEXT: slli a0, a0, 4
2223 ; CHECK-NEXT: add a0, sp, a0
2224 ; CHECK-NEXT: addi a0, a0, 16
2225 ; CHECK-NEXT: vl8r.v v8, (a0) # Unknown-size Folded Reload
2226 ; CHECK-NEXT: vmfeq.vv v0, v8, v8
2227 ; CHECK-NEXT: vmfeq.vv v7, v24, v24
2228 ; CHECK-NEXT: vmerge.vvm v16, v8, v24, v0
2229 ; CHECK-NEXT: csrr a0, vlenb
2230 ; CHECK-NEXT: slli a0, a0, 3
2231 ; CHECK-NEXT: add a0, sp, a0
2232 ; CHECK-NEXT: addi a0, a0, 16
2233 ; CHECK-NEXT: vs8r.v v16, (a0) # Unknown-size Folded Spill
2234 ; CHECK-NEXT: vmv1r.v v0, v7
2235 ; CHECK-NEXT: vmerge.vvm v24, v24, v8, v0
2236 ; CHECK-NEXT: csrr a0, vlenb
2237 ; CHECK-NEXT: slli a0, a0, 3
2238 ; CHECK-NEXT: add a0, sp, a0
2239 ; CHECK-NEXT: addi a0, a0, 16
2240 ; CHECK-NEXT: vl8r.v v8, (a0) # Unknown-size Folded Reload
2241 ; CHECK-NEXT: vfmin.vv v24, v24, v8
2242 ; CHECK-NEXT: vmfeq.vv v0, v24, v24
2243 ; CHECK-NEXT: addi a0, sp, 16
2244 ; CHECK-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
2245 ; CHECK-NEXT: vmfeq.vv v7, v16, v16
2246 ; CHECK-NEXT: vmerge.vvm v8, v24, v16, v0
2247 ; CHECK-NEXT: csrr a0, vlenb
2248 ; CHECK-NEXT: slli a0, a0, 4
2249 ; CHECK-NEXT: add a0, sp, a0
2250 ; CHECK-NEXT: addi a0, a0, 16
2251 ; CHECK-NEXT: vs8r.v v8, (a0) # Unknown-size Folded Spill
2252 ; CHECK-NEXT: vmv1r.v v0, v7
2253 ; CHECK-NEXT: vmerge.vvm v8, v16, v24, v0
2254 ; CHECK-NEXT: csrr a0, vlenb
2255 ; CHECK-NEXT: slli a0, a0, 4
2256 ; CHECK-NEXT: add a0, sp, a0
2257 ; CHECK-NEXT: addi a0, a0, 16
2258 ; CHECK-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
2259 ; CHECK-NEXT: vfmin.vv v8, v8, v16
2260 ; CHECK-NEXT: vmfne.vv v16, v8, v8
2261 ; CHECK-NEXT: vcpop.m a0, v16
2262 ; CHECK-NEXT: beqz a0, .LBB123_2
2263 ; CHECK-NEXT: # %bb.1:
2264 ; CHECK-NEXT: lui a0, %hi(.LCPI123_0)
2265 ; CHECK-NEXT: fld fa0, %lo(.LCPI123_0)(a0)
2266 ; CHECK-NEXT: j .LBB123_3
2267 ; CHECK-NEXT: .LBB123_2:
2268 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
2269 ; CHECK-NEXT: vfmv.f.s fa0, v8
2270 ; CHECK-NEXT: .LBB123_3:
2271 ; CHECK-NEXT: csrr a0, vlenb
2272 ; CHECK-NEXT: slli a0, a0, 3
2273 ; CHECK-NEXT: mv a1, a0
2274 ; CHECK-NEXT: slli a0, a0, 1
2275 ; CHECK-NEXT: add a0, a0, a1
2276 ; CHECK-NEXT: add sp, sp, a0
2277 ; CHECK-NEXT: addi sp, sp, 16
2279 %v = load <64 x double>, ptr %x
2280 %red = call double @llvm.vector.reduce.fminimum.v64f64(<64 x double> %v)
2284 define double @vreduce_fminimum_v64f64_nonans(ptr %x) {
2285 ; CHECK-LABEL: vreduce_fminimum_v64f64_nonans:
2287 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
2288 ; CHECK-NEXT: vle64.v v8, (a0)
2289 ; CHECK-NEXT: addi a1, a0, 256
2290 ; CHECK-NEXT: addi a2, a0, 384
2291 ; CHECK-NEXT: vle64.v v16, (a2)
2292 ; CHECK-NEXT: addi a0, a0, 128
2293 ; CHECK-NEXT: vle64.v v24, (a0)
2294 ; CHECK-NEXT: vle64.v v0, (a1)
2295 ; CHECK-NEXT: vfmin.vv v16, v24, v16
2296 ; CHECK-NEXT: vfmin.vv v8, v8, v0
2297 ; CHECK-NEXT: vfmin.vv v8, v8, v16
2298 ; CHECK-NEXT: vfredmin.vs v8, v8, v8
2299 ; CHECK-NEXT: vfmv.f.s fa0, v8
2301 %v = load <64 x double>, ptr %x
2302 %red = call nnan double @llvm.vector.reduce.fminimum.v64f64(<64 x double> %v)
2306 declare float @llvm.vector.reduce.fmaximum.v2f32(<2 x float>)
2308 define float @vreduce_fmaximum_v2f32(ptr %x) {
2309 ; CHECK-LABEL: vreduce_fmaximum_v2f32:
2311 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
2312 ; CHECK-NEXT: vle32.v v8, (a0)
2313 ; CHECK-NEXT: vmfne.vv v9, v8, v8
2314 ; CHECK-NEXT: vcpop.m a0, v9
2315 ; CHECK-NEXT: beqz a0, .LBB125_2
2316 ; CHECK-NEXT: # %bb.1:
2317 ; CHECK-NEXT: lui a0, 523264
2318 ; CHECK-NEXT: fmv.w.x fa0, a0
2320 ; CHECK-NEXT: .LBB125_2:
2321 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
2322 ; CHECK-NEXT: vfmv.f.s fa0, v8
2324 %v = load <2 x float>, ptr %x
2325 %red = call float @llvm.vector.reduce.fmaximum.v2f32(<2 x float> %v)
2329 define float @vreduce_fmaximum_v2f32_nonans(ptr %x) {
2330 ; CHECK-LABEL: vreduce_fmaximum_v2f32_nonans:
2332 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
2333 ; CHECK-NEXT: vle32.v v8, (a0)
2334 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
2335 ; CHECK-NEXT: vfmv.f.s fa0, v8
2337 %v = load <2 x float>, ptr %x
2338 %red = call nnan float @llvm.vector.reduce.fmaximum.v2f32(<2 x float> %v)
2342 declare float @llvm.vector.reduce.fmaximum.v4f32(<4 x float>)
2344 define float @vreduce_fmaximum_v4f32(ptr %x) {
2345 ; CHECK-LABEL: vreduce_fmaximum_v4f32:
2347 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
2348 ; CHECK-NEXT: vle32.v v8, (a0)
2349 ; CHECK-NEXT: vmfne.vv v9, v8, v8
2350 ; CHECK-NEXT: vcpop.m a0, v9
2351 ; CHECK-NEXT: beqz a0, .LBB127_2
2352 ; CHECK-NEXT: # %bb.1:
2353 ; CHECK-NEXT: lui a0, 523264
2354 ; CHECK-NEXT: fmv.w.x fa0, a0
2356 ; CHECK-NEXT: .LBB127_2:
2357 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
2358 ; CHECK-NEXT: vfmv.f.s fa0, v8
2360 %v = load <4 x float>, ptr %x
2361 %red = call float @llvm.vector.reduce.fmaximum.v4f32(<4 x float> %v)
2365 define float @vreduce_fmaximum_v4f32_nonans(ptr %x) {
2366 ; CHECK-LABEL: vreduce_fmaximum_v4f32_nonans:
2368 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
2369 ; CHECK-NEXT: vle32.v v8, (a0)
2370 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
2371 ; CHECK-NEXT: vfmv.f.s fa0, v8
2373 %v = load <4 x float>, ptr %x
2374 %red = call nnan float @llvm.vector.reduce.fmaximum.v4f32(<4 x float> %v)
2378 declare float @llvm.vector.reduce.fmaximum.v8f32(<8 x float>)
2380 define float @vreduce_fmaximum_v8f32(ptr %x) {
2381 ; CHECK-LABEL: vreduce_fmaximum_v8f32:
2383 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
2384 ; CHECK-NEXT: vle32.v v8, (a0)
2385 ; CHECK-NEXT: vmfne.vv v10, v8, v8
2386 ; CHECK-NEXT: vcpop.m a0, v10
2387 ; CHECK-NEXT: beqz a0, .LBB129_2
2388 ; CHECK-NEXT: # %bb.1:
2389 ; CHECK-NEXT: lui a0, 523264
2390 ; CHECK-NEXT: fmv.w.x fa0, a0
2392 ; CHECK-NEXT: .LBB129_2:
2393 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
2394 ; CHECK-NEXT: vfmv.f.s fa0, v8
2396 %v = load <8 x float>, ptr %x
2397 %red = call float @llvm.vector.reduce.fmaximum.v8f32(<8 x float> %v)
2401 define float @vreduce_fmaximum_v8f32_nonans(ptr %x) {
2402 ; CHECK-LABEL: vreduce_fmaximum_v8f32_nonans:
2404 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
2405 ; CHECK-NEXT: vle32.v v8, (a0)
2406 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
2407 ; CHECK-NEXT: vfmv.f.s fa0, v8
2409 %v = load <8 x float>, ptr %x
2410 %red = call nnan float @llvm.vector.reduce.fmaximum.v8f32(<8 x float> %v)
2414 declare float @llvm.vector.reduce.fmaximum.v16f32(<16 x float>)
2416 define float @vreduce_fmaximum_v16f32(ptr %x) {
2417 ; CHECK-LABEL: vreduce_fmaximum_v16f32:
2419 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
2420 ; CHECK-NEXT: vle32.v v8, (a0)
2421 ; CHECK-NEXT: vmfne.vv v12, v8, v8
2422 ; CHECK-NEXT: vcpop.m a0, v12
2423 ; CHECK-NEXT: beqz a0, .LBB131_2
2424 ; CHECK-NEXT: # %bb.1:
2425 ; CHECK-NEXT: lui a0, 523264
2426 ; CHECK-NEXT: fmv.w.x fa0, a0
2428 ; CHECK-NEXT: .LBB131_2:
2429 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
2430 ; CHECK-NEXT: vfmv.f.s fa0, v8
2432 %v = load <16 x float>, ptr %x
2433 %red = call float @llvm.vector.reduce.fmaximum.v16f32(<16 x float> %v)
2437 define float @vreduce_fmaximum_v16f32_nonans(ptr %x) {
2438 ; CHECK-LABEL: vreduce_fmaximum_v16f32_nonans:
2440 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
2441 ; CHECK-NEXT: vle32.v v8, (a0)
2442 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
2443 ; CHECK-NEXT: vfmv.f.s fa0, v8
2445 %v = load <16 x float>, ptr %x
2446 %red = call nnan float @llvm.vector.reduce.fmaximum.v16f32(<16 x float> %v)
2450 declare float @llvm.vector.reduce.fmaximum.v32f32(<32 x float>)
2452 define float @vreduce_fmaximum_v32f32(ptr %x) {
2453 ; CHECK-LABEL: vreduce_fmaximum_v32f32:
2455 ; CHECK-NEXT: li a1, 32
2456 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
2457 ; CHECK-NEXT: vle32.v v8, (a0)
2458 ; CHECK-NEXT: vmfne.vv v16, v8, v8
2459 ; CHECK-NEXT: vcpop.m a0, v16
2460 ; CHECK-NEXT: beqz a0, .LBB133_2
2461 ; CHECK-NEXT: # %bb.1:
2462 ; CHECK-NEXT: lui a0, 523264
2463 ; CHECK-NEXT: fmv.w.x fa0, a0
2465 ; CHECK-NEXT: .LBB133_2:
2466 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
2467 ; CHECK-NEXT: vfmv.f.s fa0, v8
2469 %v = load <32 x float>, ptr %x
2470 %red = call float @llvm.vector.reduce.fmaximum.v32f32(<32 x float> %v)
2474 define float @vreduce_fmaximum_v32f32_nonans(ptr %x) {
2475 ; CHECK-LABEL: vreduce_fmaximum_v32f32_nonans:
2477 ; CHECK-NEXT: li a1, 32
2478 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
2479 ; CHECK-NEXT: vle32.v v8, (a0)
2480 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
2481 ; CHECK-NEXT: vfmv.f.s fa0, v8
2483 %v = load <32 x float>, ptr %x
2484 %red = call nnan float @llvm.vector.reduce.fmaximum.v32f32(<32 x float> %v)
2488 declare float @llvm.vector.reduce.fmaximum.v64f32(<64 x float>)
2490 define float @vreduce_fmaximum_v64f32(ptr %x) {
2491 ; CHECK-LABEL: vreduce_fmaximum_v64f32:
2493 ; CHECK-NEXT: addi sp, sp, -16
2494 ; CHECK-NEXT: .cfi_def_cfa_offset 16
2495 ; CHECK-NEXT: csrr a1, vlenb
2496 ; CHECK-NEXT: slli a1, a1, 3
2497 ; CHECK-NEXT: sub sp, sp, a1
2498 ; CHECK-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x10, 0x22, 0x11, 0x08, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 16 + 8 * vlenb
2499 ; CHECK-NEXT: addi a1, a0, 128
2500 ; CHECK-NEXT: li a2, 32
2501 ; CHECK-NEXT: vsetvli zero, a2, e32, m8, ta, ma
2502 ; CHECK-NEXT: vle32.v v16, (a0)
2503 ; CHECK-NEXT: vle32.v v24, (a1)
2504 ; CHECK-NEXT: vmfeq.vv v0, v16, v16
2505 ; CHECK-NEXT: vmfeq.vv v7, v24, v24
2506 ; CHECK-NEXT: vmerge.vvm v8, v16, v24, v0
2507 ; CHECK-NEXT: addi a0, sp, 16
2508 ; CHECK-NEXT: vs8r.v v8, (a0) # Unknown-size Folded Spill
2509 ; CHECK-NEXT: vmv1r.v v0, v7
2510 ; CHECK-NEXT: vmerge.vvm v8, v24, v16, v0
2511 ; CHECK-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
2512 ; CHECK-NEXT: vfmax.vv v8, v8, v16
2513 ; CHECK-NEXT: vmfne.vv v16, v8, v8
2514 ; CHECK-NEXT: vcpop.m a0, v16
2515 ; CHECK-NEXT: beqz a0, .LBB135_2
2516 ; CHECK-NEXT: # %bb.1:
2517 ; CHECK-NEXT: lui a0, 523264
2518 ; CHECK-NEXT: fmv.w.x fa0, a0
2519 ; CHECK-NEXT: j .LBB135_3
2520 ; CHECK-NEXT: .LBB135_2:
2521 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
2522 ; CHECK-NEXT: vfmv.f.s fa0, v8
2523 ; CHECK-NEXT: .LBB135_3:
2524 ; CHECK-NEXT: csrr a0, vlenb
2525 ; CHECK-NEXT: slli a0, a0, 3
2526 ; CHECK-NEXT: add sp, sp, a0
2527 ; CHECK-NEXT: addi sp, sp, 16
2529 %v = load <64 x float>, ptr %x
2530 %red = call float @llvm.vector.reduce.fmaximum.v64f32(<64 x float> %v)
2534 define float @vreduce_fmaximum_v64f32_nonans(ptr %x) {
2535 ; CHECK-LABEL: vreduce_fmaximum_v64f32_nonans:
2537 ; CHECK-NEXT: li a1, 32
2538 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
2539 ; CHECK-NEXT: vle32.v v8, (a0)
2540 ; CHECK-NEXT: addi a0, a0, 128
2541 ; CHECK-NEXT: vle32.v v16, (a0)
2542 ; CHECK-NEXT: vfmax.vv v8, v8, v16
2543 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
2544 ; CHECK-NEXT: vfmv.f.s fa0, v8
2546 %v = load <64 x float>, ptr %x
2547 %red = call nnan float @llvm.vector.reduce.fmaximum.v64f32(<64 x float> %v)
2551 declare float @llvm.vector.reduce.fmaximum.v128f32(<128 x float>)
2553 define float @vreduce_fmaximum_v128f32(ptr %x) {
2554 ; CHECK-LABEL: vreduce_fmaximum_v128f32:
2556 ; CHECK-NEXT: addi sp, sp, -16
2557 ; CHECK-NEXT: .cfi_def_cfa_offset 16
2558 ; CHECK-NEXT: csrr a1, vlenb
2559 ; CHECK-NEXT: slli a1, a1, 3
2560 ; CHECK-NEXT: mv a2, a1
2561 ; CHECK-NEXT: slli a1, a1, 1
2562 ; CHECK-NEXT: add a1, a1, a2
2563 ; CHECK-NEXT: sub sp, sp, a1
2564 ; CHECK-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x10, 0x22, 0x11, 0x18, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 16 + 24 * vlenb
2565 ; CHECK-NEXT: li a1, 32
2566 ; CHECK-NEXT: addi a2, a0, 128
2567 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
2568 ; CHECK-NEXT: vle32.v v16, (a2)
2569 ; CHECK-NEXT: addi a1, a0, 384
2570 ; CHECK-NEXT: vle32.v v8, (a1)
2571 ; CHECK-NEXT: addi a1, a0, 256
2572 ; CHECK-NEXT: vmfeq.vv v0, v16, v16
2573 ; CHECK-NEXT: vle32.v v24, (a0)
2574 ; CHECK-NEXT: csrr a0, vlenb
2575 ; CHECK-NEXT: slli a0, a0, 4
2576 ; CHECK-NEXT: add a0, sp, a0
2577 ; CHECK-NEXT: addi a0, a0, 16
2578 ; CHECK-NEXT: vs8r.v v24, (a0) # Unknown-size Folded Spill
2579 ; CHECK-NEXT: vmerge.vvm v24, v16, v8, v0
2580 ; CHECK-NEXT: csrr a0, vlenb
2581 ; CHECK-NEXT: slli a0, a0, 3
2582 ; CHECK-NEXT: add a0, sp, a0
2583 ; CHECK-NEXT: addi a0, a0, 16
2584 ; CHECK-NEXT: vs8r.v v24, (a0) # Unknown-size Folded Spill
2585 ; CHECK-NEXT: vmfeq.vv v0, v8, v8
2586 ; CHECK-NEXT: vle32.v v24, (a1)
2587 ; CHECK-NEXT: vmerge.vvm v8, v8, v16, v0
2588 ; CHECK-NEXT: csrr a0, vlenb
2589 ; CHECK-NEXT: slli a0, a0, 3
2590 ; CHECK-NEXT: add a0, sp, a0
2591 ; CHECK-NEXT: addi a0, a0, 16
2592 ; CHECK-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
2593 ; CHECK-NEXT: vfmax.vv v8, v8, v16
2594 ; CHECK-NEXT: addi a0, sp, 16
2595 ; CHECK-NEXT: vs8r.v v8, (a0) # Unknown-size Folded Spill
2596 ; CHECK-NEXT: csrr a0, vlenb
2597 ; CHECK-NEXT: slli a0, a0, 4
2598 ; CHECK-NEXT: add a0, sp, a0
2599 ; CHECK-NEXT: addi a0, a0, 16
2600 ; CHECK-NEXT: vl8r.v v8, (a0) # Unknown-size Folded Reload
2601 ; CHECK-NEXT: vmfeq.vv v0, v8, v8
2602 ; CHECK-NEXT: vmfeq.vv v7, v24, v24
2603 ; CHECK-NEXT: vmerge.vvm v16, v8, v24, v0
2604 ; CHECK-NEXT: csrr a0, vlenb
2605 ; CHECK-NEXT: slli a0, a0, 3
2606 ; CHECK-NEXT: add a0, sp, a0
2607 ; CHECK-NEXT: addi a0, a0, 16
2608 ; CHECK-NEXT: vs8r.v v16, (a0) # Unknown-size Folded Spill
2609 ; CHECK-NEXT: vmv1r.v v0, v7
2610 ; CHECK-NEXT: vmerge.vvm v24, v24, v8, v0
2611 ; CHECK-NEXT: csrr a0, vlenb
2612 ; CHECK-NEXT: slli a0, a0, 3
2613 ; CHECK-NEXT: add a0, sp, a0
2614 ; CHECK-NEXT: addi a0, a0, 16
2615 ; CHECK-NEXT: vl8r.v v8, (a0) # Unknown-size Folded Reload
2616 ; CHECK-NEXT: vfmax.vv v24, v24, v8
2617 ; CHECK-NEXT: vmfeq.vv v0, v24, v24
2618 ; CHECK-NEXT: addi a0, sp, 16
2619 ; CHECK-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
2620 ; CHECK-NEXT: vmfeq.vv v7, v16, v16
2621 ; CHECK-NEXT: vmerge.vvm v8, v24, v16, v0
2622 ; CHECK-NEXT: csrr a0, vlenb
2623 ; CHECK-NEXT: slli a0, a0, 4
2624 ; CHECK-NEXT: add a0, sp, a0
2625 ; CHECK-NEXT: addi a0, a0, 16
2626 ; CHECK-NEXT: vs8r.v v8, (a0) # Unknown-size Folded Spill
2627 ; CHECK-NEXT: vmv1r.v v0, v7
2628 ; CHECK-NEXT: vmerge.vvm v8, v16, v24, v0
2629 ; CHECK-NEXT: csrr a0, vlenb
2630 ; CHECK-NEXT: slli a0, a0, 4
2631 ; CHECK-NEXT: add a0, sp, a0
2632 ; CHECK-NEXT: addi a0, a0, 16
2633 ; CHECK-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
2634 ; CHECK-NEXT: vfmax.vv v8, v8, v16
2635 ; CHECK-NEXT: vmfne.vv v16, v8, v8
2636 ; CHECK-NEXT: vcpop.m a0, v16
2637 ; CHECK-NEXT: beqz a0, .LBB137_2
2638 ; CHECK-NEXT: # %bb.1:
2639 ; CHECK-NEXT: lui a0, 523264
2640 ; CHECK-NEXT: fmv.w.x fa0, a0
2641 ; CHECK-NEXT: j .LBB137_3
2642 ; CHECK-NEXT: .LBB137_2:
2643 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
2644 ; CHECK-NEXT: vfmv.f.s fa0, v8
2645 ; CHECK-NEXT: .LBB137_3:
2646 ; CHECK-NEXT: csrr a0, vlenb
2647 ; CHECK-NEXT: slli a0, a0, 3
2648 ; CHECK-NEXT: mv a1, a0
2649 ; CHECK-NEXT: slli a0, a0, 1
2650 ; CHECK-NEXT: add a0, a0, a1
2651 ; CHECK-NEXT: add sp, sp, a0
2652 ; CHECK-NEXT: addi sp, sp, 16
2654 %v = load <128 x float>, ptr %x
2655 %red = call float @llvm.vector.reduce.fmaximum.v128f32(<128 x float> %v)
2659 define float @vreduce_fmaximum_v128f32_nonans(ptr %x) {
2660 ; CHECK-LABEL: vreduce_fmaximum_v128f32_nonans:
2662 ; CHECK-NEXT: li a1, 32
2663 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
2664 ; CHECK-NEXT: vle32.v v8, (a0)
2665 ; CHECK-NEXT: addi a1, a0, 384
2666 ; CHECK-NEXT: vle32.v v16, (a1)
2667 ; CHECK-NEXT: addi a1, a0, 256
2668 ; CHECK-NEXT: addi a0, a0, 128
2669 ; CHECK-NEXT: vle32.v v24, (a0)
2670 ; CHECK-NEXT: vle32.v v0, (a1)
2671 ; CHECK-NEXT: vfmax.vv v16, v24, v16
2672 ; CHECK-NEXT: vfmax.vv v8, v8, v0
2673 ; CHECK-NEXT: vfmax.vv v8, v8, v16
2674 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
2675 ; CHECK-NEXT: vfmv.f.s fa0, v8
2677 %v = load <128 x float>, ptr %x
2678 %red = call nnan float @llvm.vector.reduce.fmaximum.v128f32(<128 x float> %v)
2682 declare double @llvm.vector.reduce.fmaximum.v2f64(<2 x double>)
2684 define double @vreduce_fmaximum_v2f64(ptr %x) {
2685 ; CHECK-LABEL: vreduce_fmaximum_v2f64:
2687 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
2688 ; CHECK-NEXT: vle64.v v8, (a0)
2689 ; CHECK-NEXT: vmfne.vv v9, v8, v8
2690 ; CHECK-NEXT: vcpop.m a0, v9
2691 ; CHECK-NEXT: beqz a0, .LBB139_2
2692 ; CHECK-NEXT: # %bb.1:
2693 ; CHECK-NEXT: lui a0, %hi(.LCPI139_0)
2694 ; CHECK-NEXT: fld fa0, %lo(.LCPI139_0)(a0)
2696 ; CHECK-NEXT: .LBB139_2:
2697 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
2698 ; CHECK-NEXT: vfmv.f.s fa0, v8
2700 %v = load <2 x double>, ptr %x
2701 %red = call double @llvm.vector.reduce.fmaximum.v2f64(<2 x double> %v)
2705 define double @vreduce_fmaximum_v2f64_nonans(ptr %x) {
2706 ; CHECK-LABEL: vreduce_fmaximum_v2f64_nonans:
2708 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
2709 ; CHECK-NEXT: vle64.v v8, (a0)
2710 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
2711 ; CHECK-NEXT: vfmv.f.s fa0, v8
2713 %v = load <2 x double>, ptr %x
2714 %red = call nnan double @llvm.vector.reduce.fmaximum.v2f64(<2 x double> %v)
2718 declare double @llvm.vector.reduce.fmaximum.v4f64(<4 x double>)
2720 define double @vreduce_fmaximum_v4f64(ptr %x) {
2721 ; CHECK-LABEL: vreduce_fmaximum_v4f64:
2723 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
2724 ; CHECK-NEXT: vle64.v v8, (a0)
2725 ; CHECK-NEXT: vmfne.vv v10, v8, v8
2726 ; CHECK-NEXT: vcpop.m a0, v10
2727 ; CHECK-NEXT: beqz a0, .LBB141_2
2728 ; CHECK-NEXT: # %bb.1:
2729 ; CHECK-NEXT: lui a0, %hi(.LCPI141_0)
2730 ; CHECK-NEXT: fld fa0, %lo(.LCPI141_0)(a0)
2732 ; CHECK-NEXT: .LBB141_2:
2733 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
2734 ; CHECK-NEXT: vfmv.f.s fa0, v8
2736 %v = load <4 x double>, ptr %x
2737 %red = call double @llvm.vector.reduce.fmaximum.v4f64(<4 x double> %v)
2741 define double @vreduce_fmaximum_v4f64_nonans(ptr %x) {
2742 ; CHECK-LABEL: vreduce_fmaximum_v4f64_nonans:
2744 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
2745 ; CHECK-NEXT: vle64.v v8, (a0)
2746 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
2747 ; CHECK-NEXT: vfmv.f.s fa0, v8
2749 %v = load <4 x double>, ptr %x
2750 %red = call nnan double @llvm.vector.reduce.fmaximum.v4f64(<4 x double> %v)
2754 declare double @llvm.vector.reduce.fmaximum.v8f64(<8 x double>)
2756 define double @vreduce_fmaximum_v8f64(ptr %x) {
2757 ; CHECK-LABEL: vreduce_fmaximum_v8f64:
2759 ; CHECK-NEXT: vsetivli zero, 8, e64, m4, ta, ma
2760 ; CHECK-NEXT: vle64.v v8, (a0)
2761 ; CHECK-NEXT: vmfne.vv v12, v8, v8
2762 ; CHECK-NEXT: vcpop.m a0, v12
2763 ; CHECK-NEXT: beqz a0, .LBB143_2
2764 ; CHECK-NEXT: # %bb.1:
2765 ; CHECK-NEXT: lui a0, %hi(.LCPI143_0)
2766 ; CHECK-NEXT: fld fa0, %lo(.LCPI143_0)(a0)
2768 ; CHECK-NEXT: .LBB143_2:
2769 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
2770 ; CHECK-NEXT: vfmv.f.s fa0, v8
2772 %v = load <8 x double>, ptr %x
2773 %red = call double @llvm.vector.reduce.fmaximum.v8f64(<8 x double> %v)
2777 define double @vreduce_fmaximum_v8f64_nonans(ptr %x) {
2778 ; CHECK-LABEL: vreduce_fmaximum_v8f64_nonans:
2780 ; CHECK-NEXT: vsetivli zero, 8, e64, m4, ta, ma
2781 ; CHECK-NEXT: vle64.v v8, (a0)
2782 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
2783 ; CHECK-NEXT: vfmv.f.s fa0, v8
2785 %v = load <8 x double>, ptr %x
2786 %red = call nnan double @llvm.vector.reduce.fmaximum.v8f64(<8 x double> %v)
2790 declare double @llvm.vector.reduce.fmaximum.v16f64(<16 x double>)
2792 define double @vreduce_fmaximum_v16f64(ptr %x) {
2793 ; CHECK-LABEL: vreduce_fmaximum_v16f64:
2795 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
2796 ; CHECK-NEXT: vle64.v v8, (a0)
2797 ; CHECK-NEXT: vmfne.vv v16, v8, v8
2798 ; CHECK-NEXT: vcpop.m a0, v16
2799 ; CHECK-NEXT: beqz a0, .LBB145_2
2800 ; CHECK-NEXT: # %bb.1:
2801 ; CHECK-NEXT: lui a0, %hi(.LCPI145_0)
2802 ; CHECK-NEXT: fld fa0, %lo(.LCPI145_0)(a0)
2804 ; CHECK-NEXT: .LBB145_2:
2805 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
2806 ; CHECK-NEXT: vfmv.f.s fa0, v8
2808 %v = load <16 x double>, ptr %x
2809 %red = call double @llvm.vector.reduce.fmaximum.v16f64(<16 x double> %v)
2813 define double @vreduce_fmaximum_v16f64_nonans(ptr %x) {
2814 ; CHECK-LABEL: vreduce_fmaximum_v16f64_nonans:
2816 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
2817 ; CHECK-NEXT: vle64.v v8, (a0)
2818 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
2819 ; CHECK-NEXT: vfmv.f.s fa0, v8
2821 %v = load <16 x double>, ptr %x
2822 %red = call nnan double @llvm.vector.reduce.fmaximum.v16f64(<16 x double> %v)
2826 declare double @llvm.vector.reduce.fmaximum.v32f64(<32 x double>)
2828 define double @vreduce_fmaximum_v32f64(ptr %x) {
2829 ; CHECK-LABEL: vreduce_fmaximum_v32f64:
2831 ; CHECK-NEXT: addi sp, sp, -16
2832 ; CHECK-NEXT: .cfi_def_cfa_offset 16
2833 ; CHECK-NEXT: csrr a1, vlenb
2834 ; CHECK-NEXT: slli a1, a1, 3
2835 ; CHECK-NEXT: sub sp, sp, a1
2836 ; CHECK-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x10, 0x22, 0x11, 0x08, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 16 + 8 * vlenb
2837 ; CHECK-NEXT: addi a1, a0, 128
2838 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
2839 ; CHECK-NEXT: vle64.v v16, (a0)
2840 ; CHECK-NEXT: vle64.v v24, (a1)
2841 ; CHECK-NEXT: vmfeq.vv v0, v16, v16
2842 ; CHECK-NEXT: vmfeq.vv v7, v24, v24
2843 ; CHECK-NEXT: vmerge.vvm v8, v16, v24, v0
2844 ; CHECK-NEXT: addi a0, sp, 16
2845 ; CHECK-NEXT: vs8r.v v8, (a0) # Unknown-size Folded Spill
2846 ; CHECK-NEXT: vmv1r.v v0, v7
2847 ; CHECK-NEXT: vmerge.vvm v8, v24, v16, v0
2848 ; CHECK-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
2849 ; CHECK-NEXT: vfmax.vv v8, v8, v16
2850 ; CHECK-NEXT: vmfne.vv v16, v8, v8
2851 ; CHECK-NEXT: vcpop.m a0, v16
2852 ; CHECK-NEXT: beqz a0, .LBB147_2
2853 ; CHECK-NEXT: # %bb.1:
2854 ; CHECK-NEXT: lui a0, %hi(.LCPI147_0)
2855 ; CHECK-NEXT: fld fa0, %lo(.LCPI147_0)(a0)
2856 ; CHECK-NEXT: j .LBB147_3
2857 ; CHECK-NEXT: .LBB147_2:
2858 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
2859 ; CHECK-NEXT: vfmv.f.s fa0, v8
2860 ; CHECK-NEXT: .LBB147_3:
2861 ; CHECK-NEXT: csrr a0, vlenb
2862 ; CHECK-NEXT: slli a0, a0, 3
2863 ; CHECK-NEXT: add sp, sp, a0
2864 ; CHECK-NEXT: addi sp, sp, 16
2866 %v = load <32 x double>, ptr %x
2867 %red = call double @llvm.vector.reduce.fmaximum.v32f64(<32 x double> %v)
2871 define double @vreduce_fmaximum_v32f64_nonans(ptr %x) {
2872 ; CHECK-LABEL: vreduce_fmaximum_v32f64_nonans:
2874 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
2875 ; CHECK-NEXT: vle64.v v8, (a0)
2876 ; CHECK-NEXT: addi a0, a0, 128
2877 ; CHECK-NEXT: vle64.v v16, (a0)
2878 ; CHECK-NEXT: vfmax.vv v8, v8, v16
2879 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
2880 ; CHECK-NEXT: vfmv.f.s fa0, v8
2882 %v = load <32 x double>, ptr %x
2883 %red = call nnan double @llvm.vector.reduce.fmaximum.v32f64(<32 x double> %v)
2887 declare double @llvm.vector.reduce.fmaximum.v64f64(<64 x double>)
2889 define double @vreduce_fmaximum_v64f64(ptr %x) {
2890 ; CHECK-LABEL: vreduce_fmaximum_v64f64:
2892 ; CHECK-NEXT: addi sp, sp, -16
2893 ; CHECK-NEXT: .cfi_def_cfa_offset 16
2894 ; CHECK-NEXT: csrr a1, vlenb
2895 ; CHECK-NEXT: slli a1, a1, 3
2896 ; CHECK-NEXT: mv a2, a1
2897 ; CHECK-NEXT: slli a1, a1, 1
2898 ; CHECK-NEXT: add a1, a1, a2
2899 ; CHECK-NEXT: sub sp, sp, a1
2900 ; CHECK-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x10, 0x22, 0x11, 0x18, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 16 + 24 * vlenb
2901 ; CHECK-NEXT: addi a1, a0, 128
2902 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
2903 ; CHECK-NEXT: vle64.v v16, (a1)
2904 ; CHECK-NEXT: addi a1, a0, 384
2905 ; CHECK-NEXT: vle64.v v8, (a1)
2906 ; CHECK-NEXT: addi a1, a0, 256
2907 ; CHECK-NEXT: vmfeq.vv v0, v16, v16
2908 ; CHECK-NEXT: vle64.v v24, (a0)
2909 ; CHECK-NEXT: csrr a0, vlenb
2910 ; CHECK-NEXT: slli a0, a0, 4
2911 ; CHECK-NEXT: add a0, sp, a0
2912 ; CHECK-NEXT: addi a0, a0, 16
2913 ; CHECK-NEXT: vs8r.v v24, (a0) # Unknown-size Folded Spill
2914 ; CHECK-NEXT: vmerge.vvm v24, v16, v8, v0
2915 ; CHECK-NEXT: csrr a0, vlenb
2916 ; CHECK-NEXT: slli a0, a0, 3
2917 ; CHECK-NEXT: add a0, sp, a0
2918 ; CHECK-NEXT: addi a0, a0, 16
2919 ; CHECK-NEXT: vs8r.v v24, (a0) # Unknown-size Folded Spill
2920 ; CHECK-NEXT: vmfeq.vv v0, v8, v8
2921 ; CHECK-NEXT: vle64.v v24, (a1)
2922 ; CHECK-NEXT: vmerge.vvm v8, v8, v16, v0
2923 ; CHECK-NEXT: csrr a0, vlenb
2924 ; CHECK-NEXT: slli a0, a0, 3
2925 ; CHECK-NEXT: add a0, sp, a0
2926 ; CHECK-NEXT: addi a0, a0, 16
2927 ; CHECK-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
2928 ; CHECK-NEXT: vfmax.vv v8, v8, v16
2929 ; CHECK-NEXT: addi a0, sp, 16
2930 ; CHECK-NEXT: vs8r.v v8, (a0) # Unknown-size Folded Spill
2931 ; CHECK-NEXT: csrr a0, vlenb
2932 ; CHECK-NEXT: slli a0, a0, 4
2933 ; CHECK-NEXT: add a0, sp, a0
2934 ; CHECK-NEXT: addi a0, a0, 16
2935 ; CHECK-NEXT: vl8r.v v8, (a0) # Unknown-size Folded Reload
2936 ; CHECK-NEXT: vmfeq.vv v0, v8, v8
2937 ; CHECK-NEXT: vmfeq.vv v7, v24, v24
2938 ; CHECK-NEXT: vmerge.vvm v16, v8, v24, v0
2939 ; CHECK-NEXT: csrr a0, vlenb
2940 ; CHECK-NEXT: slli a0, a0, 3
2941 ; CHECK-NEXT: add a0, sp, a0
2942 ; CHECK-NEXT: addi a0, a0, 16
2943 ; CHECK-NEXT: vs8r.v v16, (a0) # Unknown-size Folded Spill
2944 ; CHECK-NEXT: vmv1r.v v0, v7
2945 ; CHECK-NEXT: vmerge.vvm v24, v24, v8, v0
2946 ; CHECK-NEXT: csrr a0, vlenb
2947 ; CHECK-NEXT: slli a0, a0, 3
2948 ; CHECK-NEXT: add a0, sp, a0
2949 ; CHECK-NEXT: addi a0, a0, 16
2950 ; CHECK-NEXT: vl8r.v v8, (a0) # Unknown-size Folded Reload
2951 ; CHECK-NEXT: vfmax.vv v24, v24, v8
2952 ; CHECK-NEXT: vmfeq.vv v0, v24, v24
2953 ; CHECK-NEXT: addi a0, sp, 16
2954 ; CHECK-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
2955 ; CHECK-NEXT: vmfeq.vv v7, v16, v16
2956 ; CHECK-NEXT: vmerge.vvm v8, v24, v16, v0
2957 ; CHECK-NEXT: csrr a0, vlenb
2958 ; CHECK-NEXT: slli a0, a0, 4
2959 ; CHECK-NEXT: add a0, sp, a0
2960 ; CHECK-NEXT: addi a0, a0, 16
2961 ; CHECK-NEXT: vs8r.v v8, (a0) # Unknown-size Folded Spill
2962 ; CHECK-NEXT: vmv1r.v v0, v7
2963 ; CHECK-NEXT: vmerge.vvm v8, v16, v24, v0
2964 ; CHECK-NEXT: csrr a0, vlenb
2965 ; CHECK-NEXT: slli a0, a0, 4
2966 ; CHECK-NEXT: add a0, sp, a0
2967 ; CHECK-NEXT: addi a0, a0, 16
2968 ; CHECK-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
2969 ; CHECK-NEXT: vfmax.vv v8, v8, v16
2970 ; CHECK-NEXT: vmfne.vv v16, v8, v8
2971 ; CHECK-NEXT: vcpop.m a0, v16
2972 ; CHECK-NEXT: beqz a0, .LBB149_2
2973 ; CHECK-NEXT: # %bb.1:
2974 ; CHECK-NEXT: lui a0, %hi(.LCPI149_0)
2975 ; CHECK-NEXT: fld fa0, %lo(.LCPI149_0)(a0)
2976 ; CHECK-NEXT: j .LBB149_3
2977 ; CHECK-NEXT: .LBB149_2:
2978 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
2979 ; CHECK-NEXT: vfmv.f.s fa0, v8
2980 ; CHECK-NEXT: .LBB149_3:
2981 ; CHECK-NEXT: csrr a0, vlenb
2982 ; CHECK-NEXT: slli a0, a0, 3
2983 ; CHECK-NEXT: mv a1, a0
2984 ; CHECK-NEXT: slli a0, a0, 1
2985 ; CHECK-NEXT: add a0, a0, a1
2986 ; CHECK-NEXT: add sp, sp, a0
2987 ; CHECK-NEXT: addi sp, sp, 16
2989 %v = load <64 x double>, ptr %x
2990 %red = call double @llvm.vector.reduce.fmaximum.v64f64(<64 x double> %v)
2994 define double @vreduce_fmaximum_v64f64_nonans(ptr %x) {
2995 ; CHECK-LABEL: vreduce_fmaximum_v64f64_nonans:
2997 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
2998 ; CHECK-NEXT: vle64.v v8, (a0)
2999 ; CHECK-NEXT: addi a1, a0, 256
3000 ; CHECK-NEXT: addi a2, a0, 384
3001 ; CHECK-NEXT: vle64.v v16, (a2)
3002 ; CHECK-NEXT: addi a0, a0, 128
3003 ; CHECK-NEXT: vle64.v v24, (a0)
3004 ; CHECK-NEXT: vle64.v v0, (a1)
3005 ; CHECK-NEXT: vfmax.vv v16, v24, v16
3006 ; CHECK-NEXT: vfmax.vv v8, v8, v0
3007 ; CHECK-NEXT: vfmax.vv v8, v8, v16
3008 ; CHECK-NEXT: vfredmax.vs v8, v8, v8
3009 ; CHECK-NEXT: vfmv.f.s fa0, v8
3011 %v = load <64 x double>, ptr %x
3012 %red = call nnan double @llvm.vector.reduce.fmaximum.v64f64(<64 x double> %v)