1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+m,+v -verify-machineinstrs -riscv-v-fixed-length-vector-lmul-max=1 < %s | FileCheck %s --check-prefixes=CHECK,LMULMAX1
3 ; RUN: llc -mtriple=riscv64 -mattr=+m,+v -verify-machineinstrs -riscv-v-fixed-length-vector-lmul-max=1 < %s | FileCheck %s --check-prefixes=CHECK,LMULMAX1
4 ; RUN: llc -mtriple=riscv32 -mattr=+m,+v -verify-machineinstrs -riscv-v-fixed-length-vector-lmul-max=8 < %s | FileCheck %s --check-prefixes=CHECK,LMULMAX8
5 ; RUN: llc -mtriple=riscv64 -mattr=+m,+v -verify-machineinstrs -riscv-v-fixed-length-vector-lmul-max=8 < %s | FileCheck %s --check-prefixes=CHECK,LMULMAX8
7 declare i1 @llvm.vector.reduce.or.v1i1(<1 x i1>)
9 define zeroext i1 @vreduce_or_v1i1(<1 x i1> %v) {
10 ; CHECK-LABEL: vreduce_or_v1i1:
12 ; CHECK-NEXT: vsetvli a0, zero, e8, mf8, ta, ma
13 ; CHECK-NEXT: vfirst.m a0, v0
14 ; CHECK-NEXT: seqz a0, a0
16 %red = call i1 @llvm.vector.reduce.or.v1i1(<1 x i1> %v)
20 declare i1 @llvm.vector.reduce.xor.v1i1(<1 x i1>)
22 define zeroext i1 @vreduce_xor_v1i1(<1 x i1> %v) {
23 ; CHECK-LABEL: vreduce_xor_v1i1:
25 ; CHECK-NEXT: vsetvli a0, zero, e8, mf8, ta, ma
26 ; CHECK-NEXT: vfirst.m a0, v0
27 ; CHECK-NEXT: seqz a0, a0
29 %red = call i1 @llvm.vector.reduce.xor.v1i1(<1 x i1> %v)
33 declare i1 @llvm.vector.reduce.and.v1i1(<1 x i1>)
35 define zeroext i1 @vreduce_and_v1i1(<1 x i1> %v) {
36 ; CHECK-LABEL: vreduce_and_v1i1:
38 ; CHECK-NEXT: vsetvli a0, zero, e8, mf8, ta, ma
39 ; CHECK-NEXT: vfirst.m a0, v0
40 ; CHECK-NEXT: seqz a0, a0
42 %red = call i1 @llvm.vector.reduce.and.v1i1(<1 x i1> %v)
46 declare i1 @llvm.vector.reduce.umax.v1i1(<1 x i1>)
48 define zeroext i1 @vreduce_umax_v1i1(<1 x i1> %v) {
49 ; CHECK-LABEL: vreduce_umax_v1i1:
51 ; CHECK-NEXT: vsetvli a0, zero, e8, mf8, ta, ma
52 ; CHECK-NEXT: vfirst.m a0, v0
53 ; CHECK-NEXT: seqz a0, a0
55 %red = call i1 @llvm.vector.reduce.umax.v1i1(<1 x i1> %v)
59 declare i1 @llvm.vector.reduce.smax.v1i1(<1 x i1>)
61 define zeroext i1 @vreduce_smax_v1i1(<1 x i1> %v) {
62 ; CHECK-LABEL: vreduce_smax_v1i1:
64 ; CHECK-NEXT: vsetvli a0, zero, e8, mf8, ta, ma
65 ; CHECK-NEXT: vfirst.m a0, v0
66 ; CHECK-NEXT: seqz a0, a0
68 %red = call i1 @llvm.vector.reduce.smax.v1i1(<1 x i1> %v)
72 declare i1 @llvm.vector.reduce.umin.v1i1(<1 x i1>)
74 define zeroext i1 @vreduce_umin_v1i1(<1 x i1> %v) {
75 ; CHECK-LABEL: vreduce_umin_v1i1:
77 ; CHECK-NEXT: vsetvli a0, zero, e8, mf8, ta, ma
78 ; CHECK-NEXT: vfirst.m a0, v0
79 ; CHECK-NEXT: seqz a0, a0
81 %red = call i1 @llvm.vector.reduce.umin.v1i1(<1 x i1> %v)
85 declare i1 @llvm.vector.reduce.smin.v1i1(<1 x i1>)
87 define zeroext i1 @vreduce_smin_v1i1(<1 x i1> %v) {
88 ; CHECK-LABEL: vreduce_smin_v1i1:
90 ; CHECK-NEXT: vsetvli a0, zero, e8, mf8, ta, ma
91 ; CHECK-NEXT: vfirst.m a0, v0
92 ; CHECK-NEXT: seqz a0, a0
94 %red = call i1 @llvm.vector.reduce.smin.v1i1(<1 x i1> %v)
98 declare i1 @llvm.vector.reduce.or.v2i1(<2 x i1>)
100 define zeroext i1 @vreduce_or_v2i1(<2 x i1> %v) {
101 ; CHECK-LABEL: vreduce_or_v2i1:
103 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
104 ; CHECK-NEXT: vcpop.m a0, v0
105 ; CHECK-NEXT: snez a0, a0
107 %red = call i1 @llvm.vector.reduce.or.v2i1(<2 x i1> %v)
111 declare i1 @llvm.vector.reduce.xor.v2i1(<2 x i1>)
113 define zeroext i1 @vreduce_xor_v2i1(<2 x i1> %v) {
114 ; CHECK-LABEL: vreduce_xor_v2i1:
116 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
117 ; CHECK-NEXT: vcpop.m a0, v0
118 ; CHECK-NEXT: andi a0, a0, 1
120 %red = call i1 @llvm.vector.reduce.xor.v2i1(<2 x i1> %v)
124 declare i1 @llvm.vector.reduce.and.v2i1(<2 x i1>)
126 define zeroext i1 @vreduce_and_v2i1(<2 x i1> %v) {
127 ; CHECK-LABEL: vreduce_and_v2i1:
129 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
130 ; CHECK-NEXT: vmnot.m v8, v0
131 ; CHECK-NEXT: vcpop.m a0, v8
132 ; CHECK-NEXT: seqz a0, a0
134 %red = call i1 @llvm.vector.reduce.and.v2i1(<2 x i1> %v)
138 declare i1 @llvm.vector.reduce.umax.v2i1(<2 x i1>)
140 define zeroext i1 @vreduce_umax_v2i1(<2 x i1> %v) {
141 ; CHECK-LABEL: vreduce_umax_v2i1:
143 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
144 ; CHECK-NEXT: vcpop.m a0, v0
145 ; CHECK-NEXT: snez a0, a0
147 %red = call i1 @llvm.vector.reduce.umax.v2i1(<2 x i1> %v)
151 declare i1 @llvm.vector.reduce.smax.v2i1(<2 x i1>)
153 define zeroext i1 @vreduce_smax_v2i1(<2 x i1> %v) {
154 ; CHECK-LABEL: vreduce_smax_v2i1:
156 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
157 ; CHECK-NEXT: vmnot.m v8, v0
158 ; CHECK-NEXT: vcpop.m a0, v8
159 ; CHECK-NEXT: seqz a0, a0
161 %red = call i1 @llvm.vector.reduce.smax.v2i1(<2 x i1> %v)
165 declare i1 @llvm.vector.reduce.umin.v2i1(<2 x i1>)
167 define zeroext i1 @vreduce_umin_v2i1(<2 x i1> %v) {
168 ; CHECK-LABEL: vreduce_umin_v2i1:
170 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
171 ; CHECK-NEXT: vmnot.m v8, v0
172 ; CHECK-NEXT: vcpop.m a0, v8
173 ; CHECK-NEXT: seqz a0, a0
175 %red = call i1 @llvm.vector.reduce.umin.v2i1(<2 x i1> %v)
179 declare i1 @llvm.vector.reduce.smin.v2i1(<2 x i1>)
181 define zeroext i1 @vreduce_smin_v2i1(<2 x i1> %v) {
182 ; CHECK-LABEL: vreduce_smin_v2i1:
184 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
185 ; CHECK-NEXT: vcpop.m a0, v0
186 ; CHECK-NEXT: snez a0, a0
188 %red = call i1 @llvm.vector.reduce.smin.v2i1(<2 x i1> %v)
192 declare i1 @llvm.vector.reduce.or.v4i1(<4 x i1>)
194 define zeroext i1 @vreduce_or_v4i1(<4 x i1> %v) {
195 ; CHECK-LABEL: vreduce_or_v4i1:
197 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
198 ; CHECK-NEXT: vcpop.m a0, v0
199 ; CHECK-NEXT: snez a0, a0
201 %red = call i1 @llvm.vector.reduce.or.v4i1(<4 x i1> %v)
205 declare i1 @llvm.vector.reduce.xor.v4i1(<4 x i1>)
207 define zeroext i1 @vreduce_xor_v4i1(<4 x i1> %v) {
208 ; CHECK-LABEL: vreduce_xor_v4i1:
210 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
211 ; CHECK-NEXT: vcpop.m a0, v0
212 ; CHECK-NEXT: andi a0, a0, 1
214 %red = call i1 @llvm.vector.reduce.xor.v4i1(<4 x i1> %v)
218 declare i1 @llvm.vector.reduce.and.v4i1(<4 x i1>)
220 define zeroext i1 @vreduce_and_v4i1(<4 x i1> %v) {
221 ; CHECK-LABEL: vreduce_and_v4i1:
223 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
224 ; CHECK-NEXT: vmnot.m v8, v0
225 ; CHECK-NEXT: vcpop.m a0, v8
226 ; CHECK-NEXT: seqz a0, a0
228 %red = call i1 @llvm.vector.reduce.and.v4i1(<4 x i1> %v)
232 declare i1 @llvm.vector.reduce.umax.v4i1(<4 x i1>)
234 define zeroext i1 @vreduce_umax_v4i1(<4 x i1> %v) {
235 ; CHECK-LABEL: vreduce_umax_v4i1:
237 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
238 ; CHECK-NEXT: vcpop.m a0, v0
239 ; CHECK-NEXT: snez a0, a0
241 %red = call i1 @llvm.vector.reduce.umax.v4i1(<4 x i1> %v)
245 declare i1 @llvm.vector.reduce.smax.v4i1(<4 x i1>)
247 define zeroext i1 @vreduce_smax_v4i1(<4 x i1> %v) {
248 ; CHECK-LABEL: vreduce_smax_v4i1:
250 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
251 ; CHECK-NEXT: vmnot.m v8, v0
252 ; CHECK-NEXT: vcpop.m a0, v8
253 ; CHECK-NEXT: seqz a0, a0
255 %red = call i1 @llvm.vector.reduce.smax.v4i1(<4 x i1> %v)
259 declare i1 @llvm.vector.reduce.umin.v4i1(<4 x i1>)
261 define zeroext i1 @vreduce_umin_v4i1(<4 x i1> %v) {
262 ; CHECK-LABEL: vreduce_umin_v4i1:
264 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
265 ; CHECK-NEXT: vmnot.m v8, v0
266 ; CHECK-NEXT: vcpop.m a0, v8
267 ; CHECK-NEXT: seqz a0, a0
269 %red = call i1 @llvm.vector.reduce.umin.v4i1(<4 x i1> %v)
273 declare i1 @llvm.vector.reduce.smin.v4i1(<4 x i1>)
275 define zeroext i1 @vreduce_smin_v4i1(<4 x i1> %v) {
276 ; CHECK-LABEL: vreduce_smin_v4i1:
278 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
279 ; CHECK-NEXT: vcpop.m a0, v0
280 ; CHECK-NEXT: snez a0, a0
282 %red = call i1 @llvm.vector.reduce.smin.v4i1(<4 x i1> %v)
286 declare i1 @llvm.vector.reduce.or.v8i1(<8 x i1>)
288 define zeroext i1 @vreduce_or_v8i1(<8 x i1> %v) {
289 ; CHECK-LABEL: vreduce_or_v8i1:
291 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
292 ; CHECK-NEXT: vcpop.m a0, v0
293 ; CHECK-NEXT: snez a0, a0
295 %red = call i1 @llvm.vector.reduce.or.v8i1(<8 x i1> %v)
299 declare i1 @llvm.vector.reduce.xor.v8i1(<8 x i1>)
301 define zeroext i1 @vreduce_xor_v8i1(<8 x i1> %v) {
302 ; CHECK-LABEL: vreduce_xor_v8i1:
304 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
305 ; CHECK-NEXT: vcpop.m a0, v0
306 ; CHECK-NEXT: andi a0, a0, 1
308 %red = call i1 @llvm.vector.reduce.xor.v8i1(<8 x i1> %v)
312 declare i1 @llvm.vector.reduce.and.v8i1(<8 x i1>)
314 define zeroext i1 @vreduce_and_v8i1(<8 x i1> %v) {
315 ; CHECK-LABEL: vreduce_and_v8i1:
317 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
318 ; CHECK-NEXT: vmnot.m v8, v0
319 ; CHECK-NEXT: vcpop.m a0, v8
320 ; CHECK-NEXT: seqz a0, a0
322 %red = call i1 @llvm.vector.reduce.and.v8i1(<8 x i1> %v)
326 declare i1 @llvm.vector.reduce.umax.v8i1(<8 x i1>)
328 define zeroext i1 @vreduce_umax_v8i1(<8 x i1> %v) {
329 ; CHECK-LABEL: vreduce_umax_v8i1:
331 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
332 ; CHECK-NEXT: vcpop.m a0, v0
333 ; CHECK-NEXT: snez a0, a0
335 %red = call i1 @llvm.vector.reduce.umax.v8i1(<8 x i1> %v)
339 declare i1 @llvm.vector.reduce.smax.v8i1(<8 x i1>)
341 define zeroext i1 @vreduce_smax_v8i1(<8 x i1> %v) {
342 ; CHECK-LABEL: vreduce_smax_v8i1:
344 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
345 ; CHECK-NEXT: vmnot.m v8, v0
346 ; CHECK-NEXT: vcpop.m a0, v8
347 ; CHECK-NEXT: seqz a0, a0
349 %red = call i1 @llvm.vector.reduce.smax.v8i1(<8 x i1> %v)
353 declare i1 @llvm.vector.reduce.umin.v8i1(<8 x i1>)
355 define zeroext i1 @vreduce_umin_v8i1(<8 x i1> %v) {
356 ; CHECK-LABEL: vreduce_umin_v8i1:
358 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
359 ; CHECK-NEXT: vmnot.m v8, v0
360 ; CHECK-NEXT: vcpop.m a0, v8
361 ; CHECK-NEXT: seqz a0, a0
363 %red = call i1 @llvm.vector.reduce.umin.v8i1(<8 x i1> %v)
367 declare i1 @llvm.vector.reduce.smin.v8i1(<8 x i1>)
369 define zeroext i1 @vreduce_smin_v8i1(<8 x i1> %v) {
370 ; CHECK-LABEL: vreduce_smin_v8i1:
372 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
373 ; CHECK-NEXT: vcpop.m a0, v0
374 ; CHECK-NEXT: snez a0, a0
376 %red = call i1 @llvm.vector.reduce.smin.v8i1(<8 x i1> %v)
380 declare i1 @llvm.vector.reduce.or.v16i1(<16 x i1>)
382 define zeroext i1 @vreduce_or_v16i1(<16 x i1> %v) {
383 ; CHECK-LABEL: vreduce_or_v16i1:
385 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
386 ; CHECK-NEXT: vcpop.m a0, v0
387 ; CHECK-NEXT: snez a0, a0
389 %red = call i1 @llvm.vector.reduce.or.v16i1(<16 x i1> %v)
393 declare i1 @llvm.vector.reduce.xor.v16i1(<16 x i1>)
395 define zeroext i1 @vreduce_xor_v16i1(<16 x i1> %v) {
396 ; CHECK-LABEL: vreduce_xor_v16i1:
398 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
399 ; CHECK-NEXT: vcpop.m a0, v0
400 ; CHECK-NEXT: andi a0, a0, 1
402 %red = call i1 @llvm.vector.reduce.xor.v16i1(<16 x i1> %v)
406 declare i1 @llvm.vector.reduce.and.v16i1(<16 x i1>)
408 define zeroext i1 @vreduce_and_v16i1(<16 x i1> %v) {
409 ; CHECK-LABEL: vreduce_and_v16i1:
411 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
412 ; CHECK-NEXT: vmnot.m v8, v0
413 ; CHECK-NEXT: vcpop.m a0, v8
414 ; CHECK-NEXT: seqz a0, a0
416 %red = call i1 @llvm.vector.reduce.and.v16i1(<16 x i1> %v)
420 declare i1 @llvm.vector.reduce.umax.v16i1(<16 x i1>)
422 define zeroext i1 @vreduce_umax_v16i1(<16 x i1> %v) {
423 ; CHECK-LABEL: vreduce_umax_v16i1:
425 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
426 ; CHECK-NEXT: vcpop.m a0, v0
427 ; CHECK-NEXT: snez a0, a0
429 %red = call i1 @llvm.vector.reduce.umax.v16i1(<16 x i1> %v)
433 declare i1 @llvm.vector.reduce.smax.v16i1(<16 x i1>)
435 define zeroext i1 @vreduce_smax_v16i1(<16 x i1> %v) {
436 ; CHECK-LABEL: vreduce_smax_v16i1:
438 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
439 ; CHECK-NEXT: vmnot.m v8, v0
440 ; CHECK-NEXT: vcpop.m a0, v8
441 ; CHECK-NEXT: seqz a0, a0
443 %red = call i1 @llvm.vector.reduce.smax.v16i1(<16 x i1> %v)
447 declare i1 @llvm.vector.reduce.umin.v16i1(<16 x i1>)
449 define zeroext i1 @vreduce_umin_v16i1(<16 x i1> %v) {
450 ; CHECK-LABEL: vreduce_umin_v16i1:
452 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
453 ; CHECK-NEXT: vmnot.m v8, v0
454 ; CHECK-NEXT: vcpop.m a0, v8
455 ; CHECK-NEXT: seqz a0, a0
457 %red = call i1 @llvm.vector.reduce.umin.v16i1(<16 x i1> %v)
461 declare i1 @llvm.vector.reduce.smin.v16i1(<16 x i1>)
463 define zeroext i1 @vreduce_smin_v16i1(<16 x i1> %v) {
464 ; CHECK-LABEL: vreduce_smin_v16i1:
466 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
467 ; CHECK-NEXT: vcpop.m a0, v0
468 ; CHECK-NEXT: snez a0, a0
470 %red = call i1 @llvm.vector.reduce.smin.v16i1(<16 x i1> %v)
474 declare i1 @llvm.vector.reduce.or.v32i1(<32 x i1>)
476 define zeroext i1 @vreduce_or_v32i1(<32 x i1> %v) {
477 ; LMULMAX1-LABEL: vreduce_or_v32i1:
479 ; LMULMAX1-NEXT: vsetivli zero, 16, e8, m1, ta, ma
480 ; LMULMAX1-NEXT: vmor.mm v8, v0, v8
481 ; LMULMAX1-NEXT: vcpop.m a0, v8
482 ; LMULMAX1-NEXT: snez a0, a0
485 ; LMULMAX8-LABEL: vreduce_or_v32i1:
487 ; LMULMAX8-NEXT: li a0, 32
488 ; LMULMAX8-NEXT: vsetvli zero, a0, e8, m2, ta, ma
489 ; LMULMAX8-NEXT: vcpop.m a0, v0
490 ; LMULMAX8-NEXT: snez a0, a0
492 %red = call i1 @llvm.vector.reduce.or.v32i1(<32 x i1> %v)
496 declare i1 @llvm.vector.reduce.xor.v32i1(<32 x i1>)
498 define zeroext i1 @vreduce_xor_v32i1(<32 x i1> %v) {
499 ; LMULMAX1-LABEL: vreduce_xor_v32i1:
501 ; LMULMAX1-NEXT: vsetivli zero, 16, e8, m1, ta, ma
502 ; LMULMAX1-NEXT: vmxor.mm v8, v0, v8
503 ; LMULMAX1-NEXT: vcpop.m a0, v8
504 ; LMULMAX1-NEXT: andi a0, a0, 1
507 ; LMULMAX8-LABEL: vreduce_xor_v32i1:
509 ; LMULMAX8-NEXT: li a0, 32
510 ; LMULMAX8-NEXT: vsetvli zero, a0, e8, m2, ta, ma
511 ; LMULMAX8-NEXT: vcpop.m a0, v0
512 ; LMULMAX8-NEXT: andi a0, a0, 1
514 %red = call i1 @llvm.vector.reduce.xor.v32i1(<32 x i1> %v)
518 declare i1 @llvm.vector.reduce.and.v32i1(<32 x i1>)
520 define zeroext i1 @vreduce_and_v32i1(<32 x i1> %v) {
521 ; LMULMAX1-LABEL: vreduce_and_v32i1:
523 ; LMULMAX1-NEXT: vsetivli zero, 16, e8, m1, ta, ma
524 ; LMULMAX1-NEXT: vmnand.mm v8, v0, v8
525 ; LMULMAX1-NEXT: vcpop.m a0, v8
526 ; LMULMAX1-NEXT: seqz a0, a0
529 ; LMULMAX8-LABEL: vreduce_and_v32i1:
531 ; LMULMAX8-NEXT: li a0, 32
532 ; LMULMAX8-NEXT: vsetvli zero, a0, e8, m2, ta, ma
533 ; LMULMAX8-NEXT: vmnot.m v8, v0
534 ; LMULMAX8-NEXT: vcpop.m a0, v8
535 ; LMULMAX8-NEXT: seqz a0, a0
537 %red = call i1 @llvm.vector.reduce.and.v32i1(<32 x i1> %v)
541 declare i1 @llvm.vector.reduce.umax.v32i1(<32 x i1>)
543 define zeroext i1 @vreduce_umax_v32i1(<32 x i1> %v) {
544 ; LMULMAX1-LABEL: vreduce_umax_v32i1:
546 ; LMULMAX1-NEXT: vsetivli zero, 16, e8, m1, ta, ma
547 ; LMULMAX1-NEXT: vmor.mm v8, v0, v8
548 ; LMULMAX1-NEXT: vcpop.m a0, v8
549 ; LMULMAX1-NEXT: snez a0, a0
552 ; LMULMAX8-LABEL: vreduce_umax_v32i1:
554 ; LMULMAX8-NEXT: li a0, 32
555 ; LMULMAX8-NEXT: vsetvli zero, a0, e8, m2, ta, ma
556 ; LMULMAX8-NEXT: vcpop.m a0, v0
557 ; LMULMAX8-NEXT: snez a0, a0
559 %red = call i1 @llvm.vector.reduce.umax.v32i1(<32 x i1> %v)
563 declare i1 @llvm.vector.reduce.smax.v32i1(<32 x i1>)
565 define zeroext i1 @vreduce_smax_v32i1(<32 x i1> %v) {
566 ; LMULMAX1-LABEL: vreduce_smax_v32i1:
568 ; LMULMAX1-NEXT: vsetivli zero, 16, e8, m1, ta, ma
569 ; LMULMAX1-NEXT: vmnand.mm v8, v0, v8
570 ; LMULMAX1-NEXT: vcpop.m a0, v8
571 ; LMULMAX1-NEXT: seqz a0, a0
574 ; LMULMAX8-LABEL: vreduce_smax_v32i1:
576 ; LMULMAX8-NEXT: li a0, 32
577 ; LMULMAX8-NEXT: vsetvli zero, a0, e8, m2, ta, ma
578 ; LMULMAX8-NEXT: vmnot.m v8, v0
579 ; LMULMAX8-NEXT: vcpop.m a0, v8
580 ; LMULMAX8-NEXT: seqz a0, a0
582 %red = call i1 @llvm.vector.reduce.smax.v32i1(<32 x i1> %v)
586 declare i1 @llvm.vector.reduce.umin.v32i1(<32 x i1>)
588 define zeroext i1 @vreduce_umin_v32i1(<32 x i1> %v) {
589 ; LMULMAX1-LABEL: vreduce_umin_v32i1:
591 ; LMULMAX1-NEXT: vsetivli zero, 16, e8, m1, ta, ma
592 ; LMULMAX1-NEXT: vmnand.mm v8, v0, v8
593 ; LMULMAX1-NEXT: vcpop.m a0, v8
594 ; LMULMAX1-NEXT: seqz a0, a0
597 ; LMULMAX8-LABEL: vreduce_umin_v32i1:
599 ; LMULMAX8-NEXT: li a0, 32
600 ; LMULMAX8-NEXT: vsetvli zero, a0, e8, m2, ta, ma
601 ; LMULMAX8-NEXT: vmnot.m v8, v0
602 ; LMULMAX8-NEXT: vcpop.m a0, v8
603 ; LMULMAX8-NEXT: seqz a0, a0
605 %red = call i1 @llvm.vector.reduce.umin.v32i1(<32 x i1> %v)
609 declare i1 @llvm.vector.reduce.smin.v32i1(<32 x i1>)
611 define zeroext i1 @vreduce_smin_v32i1(<32 x i1> %v) {
612 ; LMULMAX1-LABEL: vreduce_smin_v32i1:
614 ; LMULMAX1-NEXT: vsetivli zero, 16, e8, m1, ta, ma
615 ; LMULMAX1-NEXT: vmor.mm v8, v0, v8
616 ; LMULMAX1-NEXT: vcpop.m a0, v8
617 ; LMULMAX1-NEXT: snez a0, a0
620 ; LMULMAX8-LABEL: vreduce_smin_v32i1:
622 ; LMULMAX8-NEXT: li a0, 32
623 ; LMULMAX8-NEXT: vsetvli zero, a0, e8, m2, ta, ma
624 ; LMULMAX8-NEXT: vcpop.m a0, v0
625 ; LMULMAX8-NEXT: snez a0, a0
627 %red = call i1 @llvm.vector.reduce.smin.v32i1(<32 x i1> %v)
631 declare i1 @llvm.vector.reduce.or.v64i1(<64 x i1>)
633 define zeroext i1 @vreduce_or_v64i1(<64 x i1> %v) {
634 ; LMULMAX1-LABEL: vreduce_or_v64i1:
636 ; LMULMAX1-NEXT: vsetivli zero, 16, e8, m1, ta, ma
637 ; LMULMAX1-NEXT: vmor.mm v8, v8, v10
638 ; LMULMAX1-NEXT: vmor.mm v9, v0, v9
639 ; LMULMAX1-NEXT: vmor.mm v8, v9, v8
640 ; LMULMAX1-NEXT: vcpop.m a0, v8
641 ; LMULMAX1-NEXT: snez a0, a0
644 ; LMULMAX8-LABEL: vreduce_or_v64i1:
646 ; LMULMAX8-NEXT: li a0, 64
647 ; LMULMAX8-NEXT: vsetvli zero, a0, e8, m4, ta, ma
648 ; LMULMAX8-NEXT: vcpop.m a0, v0
649 ; LMULMAX8-NEXT: snez a0, a0
651 %red = call i1 @llvm.vector.reduce.or.v64i1(<64 x i1> %v)
655 declare i1 @llvm.vector.reduce.xor.v64i1(<64 x i1>)
657 define zeroext i1 @vreduce_xor_v64i1(<64 x i1> %v) {
658 ; LMULMAX1-LABEL: vreduce_xor_v64i1:
660 ; LMULMAX1-NEXT: vsetivli zero, 16, e8, m1, ta, ma
661 ; LMULMAX1-NEXT: vmxor.mm v8, v8, v10
662 ; LMULMAX1-NEXT: vmxor.mm v9, v0, v9
663 ; LMULMAX1-NEXT: vmxor.mm v8, v9, v8
664 ; LMULMAX1-NEXT: vcpop.m a0, v8
665 ; LMULMAX1-NEXT: andi a0, a0, 1
668 ; LMULMAX8-LABEL: vreduce_xor_v64i1:
670 ; LMULMAX8-NEXT: li a0, 64
671 ; LMULMAX8-NEXT: vsetvli zero, a0, e8, m4, ta, ma
672 ; LMULMAX8-NEXT: vcpop.m a0, v0
673 ; LMULMAX8-NEXT: andi a0, a0, 1
675 %red = call i1 @llvm.vector.reduce.xor.v64i1(<64 x i1> %v)
679 declare i1 @llvm.vector.reduce.and.v64i1(<64 x i1>)
681 define zeroext i1 @vreduce_and_v64i1(<64 x i1> %v) {
682 ; LMULMAX1-LABEL: vreduce_and_v64i1:
684 ; LMULMAX1-NEXT: vsetivli zero, 16, e8, m1, ta, ma
685 ; LMULMAX1-NEXT: vmand.mm v8, v8, v10
686 ; LMULMAX1-NEXT: vmand.mm v9, v0, v9
687 ; LMULMAX1-NEXT: vmnand.mm v8, v9, v8
688 ; LMULMAX1-NEXT: vcpop.m a0, v8
689 ; LMULMAX1-NEXT: seqz a0, a0
692 ; LMULMAX8-LABEL: vreduce_and_v64i1:
694 ; LMULMAX8-NEXT: li a0, 64
695 ; LMULMAX8-NEXT: vsetvli zero, a0, e8, m4, ta, ma
696 ; LMULMAX8-NEXT: vmnot.m v8, v0
697 ; LMULMAX8-NEXT: vcpop.m a0, v8
698 ; LMULMAX8-NEXT: seqz a0, a0
700 %red = call i1 @llvm.vector.reduce.and.v64i1(<64 x i1> %v)
704 declare i1 @llvm.vector.reduce.umax.v64i1(<64 x i1>)
706 define zeroext i1 @vreduce_umax_v64i1(<64 x i1> %v) {
707 ; LMULMAX1-LABEL: vreduce_umax_v64i1:
709 ; LMULMAX1-NEXT: vsetivli zero, 16, e8, m1, ta, ma
710 ; LMULMAX1-NEXT: vmor.mm v8, v8, v10
711 ; LMULMAX1-NEXT: vmor.mm v9, v0, v9
712 ; LMULMAX1-NEXT: vmor.mm v8, v9, v8
713 ; LMULMAX1-NEXT: vcpop.m a0, v8
714 ; LMULMAX1-NEXT: snez a0, a0
717 ; LMULMAX8-LABEL: vreduce_umax_v64i1:
719 ; LMULMAX8-NEXT: li a0, 64
720 ; LMULMAX8-NEXT: vsetvli zero, a0, e8, m4, ta, ma
721 ; LMULMAX8-NEXT: vcpop.m a0, v0
722 ; LMULMAX8-NEXT: snez a0, a0
724 %red = call i1 @llvm.vector.reduce.umax.v64i1(<64 x i1> %v)
728 declare i1 @llvm.vector.reduce.smax.v64i1(<64 x i1>)
730 define zeroext i1 @vreduce_smax_v64i1(<64 x i1> %v) {
731 ; LMULMAX1-LABEL: vreduce_smax_v64i1:
733 ; LMULMAX1-NEXT: vsetivli zero, 16, e8, m1, ta, ma
734 ; LMULMAX1-NEXT: vmand.mm v8, v8, v10
735 ; LMULMAX1-NEXT: vmand.mm v9, v0, v9
736 ; LMULMAX1-NEXT: vmnand.mm v8, v9, v8
737 ; LMULMAX1-NEXT: vcpop.m a0, v8
738 ; LMULMAX1-NEXT: seqz a0, a0
741 ; LMULMAX8-LABEL: vreduce_smax_v64i1:
743 ; LMULMAX8-NEXT: li a0, 64
744 ; LMULMAX8-NEXT: vsetvli zero, a0, e8, m4, ta, ma
745 ; LMULMAX8-NEXT: vmnot.m v8, v0
746 ; LMULMAX8-NEXT: vcpop.m a0, v8
747 ; LMULMAX8-NEXT: seqz a0, a0
749 %red = call i1 @llvm.vector.reduce.smax.v64i1(<64 x i1> %v)
753 declare i1 @llvm.vector.reduce.umin.v64i1(<64 x i1>)
755 define zeroext i1 @vreduce_umin_v64i1(<64 x i1> %v) {
756 ; LMULMAX1-LABEL: vreduce_umin_v64i1:
758 ; LMULMAX1-NEXT: vsetivli zero, 16, e8, m1, ta, ma
759 ; LMULMAX1-NEXT: vmand.mm v8, v8, v10
760 ; LMULMAX1-NEXT: vmand.mm v9, v0, v9
761 ; LMULMAX1-NEXT: vmnand.mm v8, v9, v8
762 ; LMULMAX1-NEXT: vcpop.m a0, v8
763 ; LMULMAX1-NEXT: seqz a0, a0
766 ; LMULMAX8-LABEL: vreduce_umin_v64i1:
768 ; LMULMAX8-NEXT: li a0, 64
769 ; LMULMAX8-NEXT: vsetvli zero, a0, e8, m4, ta, ma
770 ; LMULMAX8-NEXT: vmnot.m v8, v0
771 ; LMULMAX8-NEXT: vcpop.m a0, v8
772 ; LMULMAX8-NEXT: seqz a0, a0
774 %red = call i1 @llvm.vector.reduce.umin.v64i1(<64 x i1> %v)
778 declare i1 @llvm.vector.reduce.smin.v64i1(<64 x i1>)
780 define zeroext i1 @vreduce_smin_v64i1(<64 x i1> %v) {
781 ; LMULMAX1-LABEL: vreduce_smin_v64i1:
783 ; LMULMAX1-NEXT: vsetivli zero, 16, e8, m1, ta, ma
784 ; LMULMAX1-NEXT: vmor.mm v8, v8, v10
785 ; LMULMAX1-NEXT: vmor.mm v9, v0, v9
786 ; LMULMAX1-NEXT: vmor.mm v8, v9, v8
787 ; LMULMAX1-NEXT: vcpop.m a0, v8
788 ; LMULMAX1-NEXT: snez a0, a0
791 ; LMULMAX8-LABEL: vreduce_smin_v64i1:
793 ; LMULMAX8-NEXT: li a0, 64
794 ; LMULMAX8-NEXT: vsetvli zero, a0, e8, m4, ta, ma
795 ; LMULMAX8-NEXT: vcpop.m a0, v0
796 ; LMULMAX8-NEXT: snez a0, a0
798 %red = call i1 @llvm.vector.reduce.smin.v64i1(<64 x i1> %v)
802 declare i1 @llvm.vector.reduce.add.v1i1(<1 x i1>)
804 define zeroext i1 @vreduce_add_v1i1(<1 x i1> %v) {
805 ; CHECK-LABEL: vreduce_add_v1i1:
807 ; CHECK-NEXT: vsetvli a0, zero, e8, mf8, ta, ma
808 ; CHECK-NEXT: vfirst.m a0, v0
809 ; CHECK-NEXT: seqz a0, a0
811 %red = call i1 @llvm.vector.reduce.add.v1i1(<1 x i1> %v)
815 declare i1 @llvm.vector.reduce.add.v2i1(<2 x i1>)
817 define zeroext i1 @vreduce_add_v2i1(<2 x i1> %v) {
818 ; CHECK-LABEL: vreduce_add_v2i1:
820 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
821 ; CHECK-NEXT: vcpop.m a0, v0
822 ; CHECK-NEXT: andi a0, a0, 1
824 %red = call i1 @llvm.vector.reduce.add.v2i1(<2 x i1> %v)
828 declare i1 @llvm.vector.reduce.add.v4i1(<4 x i1>)
830 define zeroext i1 @vreduce_add_v4i1(<4 x i1> %v) {
831 ; CHECK-LABEL: vreduce_add_v4i1:
833 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
834 ; CHECK-NEXT: vcpop.m a0, v0
835 ; CHECK-NEXT: andi a0, a0, 1
837 %red = call i1 @llvm.vector.reduce.add.v4i1(<4 x i1> %v)
841 declare i1 @llvm.vector.reduce.add.v8i1(<8 x i1>)
843 define zeroext i1 @vreduce_add_v8i1(<8 x i1> %v) {
844 ; CHECK-LABEL: vreduce_add_v8i1:
846 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
847 ; CHECK-NEXT: vcpop.m a0, v0
848 ; CHECK-NEXT: andi a0, a0, 1
850 %red = call i1 @llvm.vector.reduce.add.v8i1(<8 x i1> %v)
854 declare i1 @llvm.vector.reduce.add.v16i1(<16 x i1>)
856 define zeroext i1 @vreduce_add_v16i1(<16 x i1> %v) {
857 ; CHECK-LABEL: vreduce_add_v16i1:
859 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
860 ; CHECK-NEXT: vcpop.m a0, v0
861 ; CHECK-NEXT: andi a0, a0, 1
863 %red = call i1 @llvm.vector.reduce.add.v16i1(<16 x i1> %v)
867 declare i1 @llvm.vector.reduce.add.v32i1(<32 x i1>)
869 define zeroext i1 @vreduce_add_v32i1(<32 x i1> %v) {
870 ; LMULMAX1-LABEL: vreduce_add_v32i1:
872 ; LMULMAX1-NEXT: vsetivli zero, 16, e8, m1, ta, ma
873 ; LMULMAX1-NEXT: vmxor.mm v8, v0, v8
874 ; LMULMAX1-NEXT: vcpop.m a0, v8
875 ; LMULMAX1-NEXT: andi a0, a0, 1
878 ; LMULMAX8-LABEL: vreduce_add_v32i1:
880 ; LMULMAX8-NEXT: li a0, 32
881 ; LMULMAX8-NEXT: vsetvli zero, a0, e8, m2, ta, ma
882 ; LMULMAX8-NEXT: vcpop.m a0, v0
883 ; LMULMAX8-NEXT: andi a0, a0, 1
885 %red = call i1 @llvm.vector.reduce.add.v32i1(<32 x i1> %v)
889 declare i1 @llvm.vector.reduce.add.v64i1(<64 x i1>)
891 define zeroext i1 @vreduce_add_v64i1(<64 x i1> %v) {
892 ; LMULMAX1-LABEL: vreduce_add_v64i1:
894 ; LMULMAX1-NEXT: vsetivli zero, 16, e8, m1, ta, ma
895 ; LMULMAX1-NEXT: vmxor.mm v8, v8, v10
896 ; LMULMAX1-NEXT: vmxor.mm v9, v0, v9
897 ; LMULMAX1-NEXT: vmxor.mm v8, v9, v8
898 ; LMULMAX1-NEXT: vcpop.m a0, v8
899 ; LMULMAX1-NEXT: andi a0, a0, 1
902 ; LMULMAX8-LABEL: vreduce_add_v64i1:
904 ; LMULMAX8-NEXT: li a0, 64
905 ; LMULMAX8-NEXT: vsetvli zero, a0, e8, m4, ta, ma
906 ; LMULMAX8-NEXT: vcpop.m a0, v0
907 ; LMULMAX8-NEXT: andi a0, a0, 1
909 %red = call i1 @llvm.vector.reduce.add.v64i1(<64 x i1> %v)