1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=riscv32 | FileCheck %s --check-prefixes=NOZBB,RV32I
3 ; RUN: llc < %s -mtriple=riscv64 | FileCheck %s --check-prefixes=NOZBB,RV64I
4 ; RUN: llc < %s -mtriple=riscv32 -mattr=+zbb | \
5 ; RUN: FileCheck %s --check-prefixes=ZBB,RV32ZBB
6 ; RUN: llc < %s -mtriple=riscv64 -mattr=+zbb | \
7 ; RUN: FileCheck %s --check-prefixes=ZBB,RV64ZBB
11 declare i8 @llvm.smax.i8(i8 %a, i8 %b) readnone
13 define signext i8 @smax_i8(i8 signext %a, i8 signext %b) {
14 ; NOZBB-LABEL: smax_i8:
16 ; NOZBB-NEXT: blt a1, a0, .LBB0_2
17 ; NOZBB-NEXT: # %bb.1:
18 ; NOZBB-NEXT: mv a0, a1
19 ; NOZBB-NEXT: .LBB0_2:
24 ; ZBB-NEXT: max a0, a0, a1
26 %c = call i8 @llvm.smax.i8(i8 %a, i8 %b)
30 declare i16 @llvm.smax.i16(i16 %a, i16 %b) readnone
32 define signext i16 @smax_i16(i16 signext %a, i16 signext %b) {
33 ; NOZBB-LABEL: smax_i16:
35 ; NOZBB-NEXT: blt a1, a0, .LBB1_2
36 ; NOZBB-NEXT: # %bb.1:
37 ; NOZBB-NEXT: mv a0, a1
38 ; NOZBB-NEXT: .LBB1_2:
41 ; ZBB-LABEL: smax_i16:
43 ; ZBB-NEXT: max a0, a0, a1
45 %c = call i16 @llvm.smax.i16(i16 %a, i16 %b)
49 declare i32 @llvm.smax.i32(i32 %a, i32 %b) readnone
51 define signext i32 @smax_i32(i32 signext %a, i32 signext %b) {
52 ; NOZBB-LABEL: smax_i32:
54 ; NOZBB-NEXT: blt a1, a0, .LBB2_2
55 ; NOZBB-NEXT: # %bb.1:
56 ; NOZBB-NEXT: mv a0, a1
57 ; NOZBB-NEXT: .LBB2_2:
60 ; ZBB-LABEL: smax_i32:
62 ; ZBB-NEXT: max a0, a0, a1
64 %c = call i32 @llvm.smax.i32(i32 %a, i32 %b)
68 declare i64 @llvm.smax.i64(i64 %a, i64 %b) readnone
70 define i64 @smax_i64(i64 %a, i64 %b) {
71 ; RV32I-LABEL: smax_i64:
73 ; RV32I-NEXT: mv a4, a0
74 ; RV32I-NEXT: bge a3, a1, .LBB3_5
75 ; RV32I-NEXT: # %bb.1:
76 ; RV32I-NEXT: bgeu a2, a0, .LBB3_6
77 ; RV32I-NEXT: .LBB3_2:
78 ; RV32I-NEXT: bne a1, a3, .LBB3_7
79 ; RV32I-NEXT: .LBB3_3:
80 ; RV32I-NEXT: bge a3, a1, .LBB3_8
81 ; RV32I-NEXT: .LBB3_4:
83 ; RV32I-NEXT: .LBB3_5:
84 ; RV32I-NEXT: mv a4, a2
85 ; RV32I-NEXT: bltu a2, a0, .LBB3_2
86 ; RV32I-NEXT: .LBB3_6:
87 ; RV32I-NEXT: mv a0, a2
88 ; RV32I-NEXT: beq a1, a3, .LBB3_3
89 ; RV32I-NEXT: .LBB3_7:
90 ; RV32I-NEXT: mv a0, a4
91 ; RV32I-NEXT: blt a3, a1, .LBB3_4
92 ; RV32I-NEXT: .LBB3_8:
93 ; RV32I-NEXT: mv a1, a3
96 ; RV64I-LABEL: smax_i64:
98 ; RV64I-NEXT: blt a1, a0, .LBB3_2
99 ; RV64I-NEXT: # %bb.1:
100 ; RV64I-NEXT: mv a0, a1
101 ; RV64I-NEXT: .LBB3_2:
104 ; RV32ZBB-LABEL: smax_i64:
106 ; RV32ZBB-NEXT: mv a4, a0
107 ; RV32ZBB-NEXT: bge a3, a1, .LBB3_3
108 ; RV32ZBB-NEXT: # %bb.1:
109 ; RV32ZBB-NEXT: beq a1, a3, .LBB3_4
110 ; RV32ZBB-NEXT: .LBB3_2:
111 ; RV32ZBB-NEXT: max a1, a1, a3
113 ; RV32ZBB-NEXT: .LBB3_3:
114 ; RV32ZBB-NEXT: mv a0, a2
115 ; RV32ZBB-NEXT: bne a1, a3, .LBB3_2
116 ; RV32ZBB-NEXT: .LBB3_4:
117 ; RV32ZBB-NEXT: maxu a0, a4, a2
118 ; RV32ZBB-NEXT: max a1, a1, a3
121 ; RV64ZBB-LABEL: smax_i64:
123 ; RV64ZBB-NEXT: max a0, a0, a1
125 %c = call i64 @llvm.smax.i64(i64 %a, i64 %b)
129 declare i8 @llvm.smin.i8(i8 %a, i8 %b) readnone
131 define signext i8 @smin_i8(i8 signext %a, i8 signext %b) {
132 ; NOZBB-LABEL: smin_i8:
134 ; NOZBB-NEXT: blt a0, a1, .LBB4_2
135 ; NOZBB-NEXT: # %bb.1:
136 ; NOZBB-NEXT: mv a0, a1
137 ; NOZBB-NEXT: .LBB4_2:
140 ; ZBB-LABEL: smin_i8:
142 ; ZBB-NEXT: min a0, a0, a1
144 %c = call i8 @llvm.smin.i8(i8 %a, i8 %b)
148 declare i16 @llvm.smin.i16(i16 %a, i16 %b) readnone
150 define signext i16 @smin_i16(i16 signext %a, i16 signext %b) {
151 ; NOZBB-LABEL: smin_i16:
153 ; NOZBB-NEXT: blt a0, a1, .LBB5_2
154 ; NOZBB-NEXT: # %bb.1:
155 ; NOZBB-NEXT: mv a0, a1
156 ; NOZBB-NEXT: .LBB5_2:
159 ; ZBB-LABEL: smin_i16:
161 ; ZBB-NEXT: min a0, a0, a1
163 %c = call i16 @llvm.smin.i16(i16 %a, i16 %b)
167 declare i32 @llvm.smin.i32(i32 %a, i32 %b) readnone
169 define signext i32 @smin_i32(i32 signext %a, i32 signext %b) {
170 ; NOZBB-LABEL: smin_i32:
172 ; NOZBB-NEXT: blt a0, a1, .LBB6_2
173 ; NOZBB-NEXT: # %bb.1:
174 ; NOZBB-NEXT: mv a0, a1
175 ; NOZBB-NEXT: .LBB6_2:
178 ; ZBB-LABEL: smin_i32:
180 ; ZBB-NEXT: min a0, a0, a1
182 %c = call i32 @llvm.smin.i32(i32 %a, i32 %b)
186 declare i64 @llvm.smin.i64(i64 %a, i64 %b) readnone
188 define i64 @smin_i64(i64 %a, i64 %b) {
189 ; RV32I-LABEL: smin_i64:
191 ; RV32I-NEXT: mv a4, a0
192 ; RV32I-NEXT: bge a1, a3, .LBB7_5
193 ; RV32I-NEXT: # %bb.1:
194 ; RV32I-NEXT: bgeu a0, a2, .LBB7_6
195 ; RV32I-NEXT: .LBB7_2:
196 ; RV32I-NEXT: bne a1, a3, .LBB7_7
197 ; RV32I-NEXT: .LBB7_3:
198 ; RV32I-NEXT: bge a1, a3, .LBB7_8
199 ; RV32I-NEXT: .LBB7_4:
201 ; RV32I-NEXT: .LBB7_5:
202 ; RV32I-NEXT: mv a4, a2
203 ; RV32I-NEXT: bltu a0, a2, .LBB7_2
204 ; RV32I-NEXT: .LBB7_6:
205 ; RV32I-NEXT: mv a0, a2
206 ; RV32I-NEXT: beq a1, a3, .LBB7_3
207 ; RV32I-NEXT: .LBB7_7:
208 ; RV32I-NEXT: mv a0, a4
209 ; RV32I-NEXT: blt a1, a3, .LBB7_4
210 ; RV32I-NEXT: .LBB7_8:
211 ; RV32I-NEXT: mv a1, a3
214 ; RV64I-LABEL: smin_i64:
216 ; RV64I-NEXT: blt a0, a1, .LBB7_2
217 ; RV64I-NEXT: # %bb.1:
218 ; RV64I-NEXT: mv a0, a1
219 ; RV64I-NEXT: .LBB7_2:
222 ; RV32ZBB-LABEL: smin_i64:
224 ; RV32ZBB-NEXT: mv a4, a0
225 ; RV32ZBB-NEXT: bge a1, a3, .LBB7_3
226 ; RV32ZBB-NEXT: # %bb.1:
227 ; RV32ZBB-NEXT: beq a1, a3, .LBB7_4
228 ; RV32ZBB-NEXT: .LBB7_2:
229 ; RV32ZBB-NEXT: min a1, a1, a3
231 ; RV32ZBB-NEXT: .LBB7_3:
232 ; RV32ZBB-NEXT: mv a0, a2
233 ; RV32ZBB-NEXT: bne a1, a3, .LBB7_2
234 ; RV32ZBB-NEXT: .LBB7_4:
235 ; RV32ZBB-NEXT: minu a0, a4, a2
236 ; RV32ZBB-NEXT: min a1, a1, a3
239 ; RV64ZBB-LABEL: smin_i64:
241 ; RV64ZBB-NEXT: min a0, a0, a1
243 %c = call i64 @llvm.smin.i64(i64 %a, i64 %b)
247 declare i8 @llvm.umax.i8(i8 %a, i8 %b) readnone
249 define i8 @umax_i8(i8 zeroext %a, i8 zeroext %b) {
250 ; NOZBB-LABEL: umax_i8:
252 ; NOZBB-NEXT: bltu a1, a0, .LBB8_2
253 ; NOZBB-NEXT: # %bb.1:
254 ; NOZBB-NEXT: mv a0, a1
255 ; NOZBB-NEXT: .LBB8_2:
258 ; ZBB-LABEL: umax_i8:
260 ; ZBB-NEXT: maxu a0, a0, a1
262 %c = call i8 @llvm.umax.i8(i8 %a, i8 %b)
266 declare i16 @llvm.umax.i16(i16 %a, i16 %b) readnone
268 define i16 @umax_i16(i16 zeroext %a, i16 zeroext %b) {
269 ; NOZBB-LABEL: umax_i16:
271 ; NOZBB-NEXT: bltu a1, a0, .LBB9_2
272 ; NOZBB-NEXT: # %bb.1:
273 ; NOZBB-NEXT: mv a0, a1
274 ; NOZBB-NEXT: .LBB9_2:
277 ; ZBB-LABEL: umax_i16:
279 ; ZBB-NEXT: maxu a0, a0, a1
281 %c = call i16 @llvm.umax.i16(i16 %a, i16 %b)
285 declare i32 @llvm.umax.i32(i32 %a, i32 %b) readnone
287 define signext i32 @umax_i32(i32 signext %a, i32 signext %b) {
288 ; NOZBB-LABEL: umax_i32:
290 ; NOZBB-NEXT: bltu a1, a0, .LBB10_2
291 ; NOZBB-NEXT: # %bb.1:
292 ; NOZBB-NEXT: mv a0, a1
293 ; NOZBB-NEXT: .LBB10_2:
296 ; ZBB-LABEL: umax_i32:
298 ; ZBB-NEXT: maxu a0, a0, a1
300 %c = call i32 @llvm.umax.i32(i32 %a, i32 %b)
304 declare i64 @llvm.umax.i64(i64 %a, i64 %b) readnone
306 define i64 @umax_i64(i64 %a, i64 %b) {
307 ; RV32I-LABEL: umax_i64:
309 ; RV32I-NEXT: mv a4, a0
310 ; RV32I-NEXT: bgeu a3, a1, .LBB11_5
311 ; RV32I-NEXT: # %bb.1:
312 ; RV32I-NEXT: bgeu a2, a0, .LBB11_6
313 ; RV32I-NEXT: .LBB11_2:
314 ; RV32I-NEXT: bne a1, a3, .LBB11_7
315 ; RV32I-NEXT: .LBB11_3:
316 ; RV32I-NEXT: bgeu a3, a1, .LBB11_8
317 ; RV32I-NEXT: .LBB11_4:
319 ; RV32I-NEXT: .LBB11_5:
320 ; RV32I-NEXT: mv a4, a2
321 ; RV32I-NEXT: bltu a2, a0, .LBB11_2
322 ; RV32I-NEXT: .LBB11_6:
323 ; RV32I-NEXT: mv a0, a2
324 ; RV32I-NEXT: beq a1, a3, .LBB11_3
325 ; RV32I-NEXT: .LBB11_7:
326 ; RV32I-NEXT: mv a0, a4
327 ; RV32I-NEXT: bltu a3, a1, .LBB11_4
328 ; RV32I-NEXT: .LBB11_8:
329 ; RV32I-NEXT: mv a1, a3
332 ; RV64I-LABEL: umax_i64:
334 ; RV64I-NEXT: bltu a1, a0, .LBB11_2
335 ; RV64I-NEXT: # %bb.1:
336 ; RV64I-NEXT: mv a0, a1
337 ; RV64I-NEXT: .LBB11_2:
340 ; RV32ZBB-LABEL: umax_i64:
342 ; RV32ZBB-NEXT: mv a4, a0
343 ; RV32ZBB-NEXT: bgeu a3, a1, .LBB11_3
344 ; RV32ZBB-NEXT: # %bb.1:
345 ; RV32ZBB-NEXT: beq a1, a3, .LBB11_4
346 ; RV32ZBB-NEXT: .LBB11_2:
347 ; RV32ZBB-NEXT: maxu a1, a1, a3
349 ; RV32ZBB-NEXT: .LBB11_3:
350 ; RV32ZBB-NEXT: mv a0, a2
351 ; RV32ZBB-NEXT: bne a1, a3, .LBB11_2
352 ; RV32ZBB-NEXT: .LBB11_4:
353 ; RV32ZBB-NEXT: maxu a0, a4, a2
354 ; RV32ZBB-NEXT: maxu a1, a1, a3
357 ; RV64ZBB-LABEL: umax_i64:
359 ; RV64ZBB-NEXT: maxu a0, a0, a1
361 %c = call i64 @llvm.umax.i64(i64 %a, i64 %b)
365 declare i8 @llvm.umin.i8(i8 %a, i8 %b) readnone
367 define zeroext i8 @umin_i8(i8 zeroext %a, i8 zeroext %b) {
368 ; NOZBB-LABEL: umin_i8:
370 ; NOZBB-NEXT: bltu a0, a1, .LBB12_2
371 ; NOZBB-NEXT: # %bb.1:
372 ; NOZBB-NEXT: mv a0, a1
373 ; NOZBB-NEXT: .LBB12_2:
376 ; ZBB-LABEL: umin_i8:
378 ; ZBB-NEXT: minu a0, a0, a1
380 %c = call i8 @llvm.umin.i8(i8 %a, i8 %b)
384 declare i16 @llvm.umin.i16(i16 %a, i16 %b) readnone
386 define zeroext i16 @umin_i16(i16 zeroext %a, i16 zeroext %b) {
387 ; NOZBB-LABEL: umin_i16:
389 ; NOZBB-NEXT: bltu a0, a1, .LBB13_2
390 ; NOZBB-NEXT: # %bb.1:
391 ; NOZBB-NEXT: mv a0, a1
392 ; NOZBB-NEXT: .LBB13_2:
395 ; ZBB-LABEL: umin_i16:
397 ; ZBB-NEXT: minu a0, a0, a1
399 %c = call i16 @llvm.umin.i16(i16 %a, i16 %b)
403 declare i32 @llvm.umin.i32(i32 %a, i32 %b) readnone
405 define signext i32 @umin_i32(i32 signext %a, i32 signext %b) {
406 ; NOZBB-LABEL: umin_i32:
408 ; NOZBB-NEXT: bltu a0, a1, .LBB14_2
409 ; NOZBB-NEXT: # %bb.1:
410 ; NOZBB-NEXT: mv a0, a1
411 ; NOZBB-NEXT: .LBB14_2:
414 ; ZBB-LABEL: umin_i32:
416 ; ZBB-NEXT: minu a0, a0, a1
418 %c = call i32 @llvm.umin.i32(i32 %a, i32 %b)
422 declare i64 @llvm.umin.i64(i64 %a, i64 %b) readnone
424 define i64 @umin_i64(i64 %a, i64 %b) {
425 ; RV32I-LABEL: umin_i64:
427 ; RV32I-NEXT: mv a4, a0
428 ; RV32I-NEXT: bgeu a1, a3, .LBB15_5
429 ; RV32I-NEXT: # %bb.1:
430 ; RV32I-NEXT: bgeu a0, a2, .LBB15_6
431 ; RV32I-NEXT: .LBB15_2:
432 ; RV32I-NEXT: bne a1, a3, .LBB15_7
433 ; RV32I-NEXT: .LBB15_3:
434 ; RV32I-NEXT: bgeu a1, a3, .LBB15_8
435 ; RV32I-NEXT: .LBB15_4:
437 ; RV32I-NEXT: .LBB15_5:
438 ; RV32I-NEXT: mv a4, a2
439 ; RV32I-NEXT: bltu a0, a2, .LBB15_2
440 ; RV32I-NEXT: .LBB15_6:
441 ; RV32I-NEXT: mv a0, a2
442 ; RV32I-NEXT: beq a1, a3, .LBB15_3
443 ; RV32I-NEXT: .LBB15_7:
444 ; RV32I-NEXT: mv a0, a4
445 ; RV32I-NEXT: bltu a1, a3, .LBB15_4
446 ; RV32I-NEXT: .LBB15_8:
447 ; RV32I-NEXT: mv a1, a3
450 ; RV64I-LABEL: umin_i64:
452 ; RV64I-NEXT: bltu a0, a1, .LBB15_2
453 ; RV64I-NEXT: # %bb.1:
454 ; RV64I-NEXT: mv a0, a1
455 ; RV64I-NEXT: .LBB15_2:
458 ; RV32ZBB-LABEL: umin_i64:
460 ; RV32ZBB-NEXT: mv a4, a0
461 ; RV32ZBB-NEXT: bgeu a1, a3, .LBB15_3
462 ; RV32ZBB-NEXT: # %bb.1:
463 ; RV32ZBB-NEXT: beq a1, a3, .LBB15_4
464 ; RV32ZBB-NEXT: .LBB15_2:
465 ; RV32ZBB-NEXT: minu a1, a1, a3
467 ; RV32ZBB-NEXT: .LBB15_3:
468 ; RV32ZBB-NEXT: mv a0, a2
469 ; RV32ZBB-NEXT: bne a1, a3, .LBB15_2
470 ; RV32ZBB-NEXT: .LBB15_4:
471 ; RV32ZBB-NEXT: minu a0, a4, a2
472 ; RV32ZBB-NEXT: minu a1, a1, a3
475 ; RV64ZBB-LABEL: umin_i64:
477 ; RV64ZBB-NEXT: minu a0, a0, a1
479 %c = call i64 @llvm.umin.i64(i64 %a, i64 %b)
483 ; Tests with the same operand used twice. These should fold away.
485 define signext i32 @smin_same_op_i32(i32 signext %a) {
486 ; NOZBB-LABEL: smin_same_op_i32:
490 ; ZBB-LABEL: smin_same_op_i32:
493 %c = call i32 @llvm.smin.i32(i32 %a, i32 %a)
497 define signext i32 @smax_same_op_i32(i32 signext %a) {
498 ; NOZBB-LABEL: smax_same_op_i32:
502 ; ZBB-LABEL: smax_same_op_i32:
505 %c = call i32 @llvm.smax.i32(i32 %a, i32 %a)
509 define signext i32 @umin_same_op_i32(i32 signext %a) {
510 ; NOZBB-LABEL: umin_same_op_i32:
514 ; ZBB-LABEL: umin_same_op_i32:
517 %c = call i32 @llvm.umin.i32(i32 %a, i32 %a)
521 define signext i32 @umax_same_op_i32(i32 signext %a) {
522 ; NOZBB-LABEL: umax_same_op_i32:
526 ; ZBB-LABEL: umax_same_op_i32:
529 %c = call i32 @llvm.umax.i32(i32 %a, i32 %a)
533 ; Tests with undef operands. These should fold to undef for RV32 or 0 for RV64.
535 define signext i32 @smin_undef_i32() {
536 ; RV32I-LABEL: smin_undef_i32:
540 ; RV64I-LABEL: smin_undef_i32:
542 ; RV64I-NEXT: li a0, 0
545 ; RV32ZBB-LABEL: smin_undef_i32:
549 ; RV64ZBB-LABEL: smin_undef_i32:
551 ; RV64ZBB-NEXT: li a0, 0
553 %c = call i32 @llvm.smin.i32(i32 undef, i32 undef)
557 define signext i32 @smax_undef_i32() {
558 ; RV32I-LABEL: smax_undef_i32:
562 ; RV64I-LABEL: smax_undef_i32:
564 ; RV64I-NEXT: li a0, 0
567 ; RV32ZBB-LABEL: smax_undef_i32:
571 ; RV64ZBB-LABEL: smax_undef_i32:
573 ; RV64ZBB-NEXT: li a0, 0
575 %c = call i32 @llvm.smax.i32(i32 undef, i32 undef)
579 define signext i32 @umin_undef_i32() {
580 ; RV32I-LABEL: umin_undef_i32:
584 ; RV64I-LABEL: umin_undef_i32:
586 ; RV64I-NEXT: li a0, 0
589 ; RV32ZBB-LABEL: umin_undef_i32:
593 ; RV64ZBB-LABEL: umin_undef_i32:
595 ; RV64ZBB-NEXT: li a0, 0
597 %c = call i32 @llvm.umin.i32(i32 undef, i32 undef)
601 define signext i32 @umax_undef_i32() {
602 ; RV32I-LABEL: umax_undef_i32:
606 ; RV64I-LABEL: umax_undef_i32:
608 ; RV64I-NEXT: li a0, 0
611 ; RV32ZBB-LABEL: umax_undef_i32:
615 ; RV64ZBB-LABEL: umax_undef_i32:
617 ; RV64ZBB-NEXT: li a0, 0
619 %c = call i32 @llvm.umax.i32(i32 undef, i32 undef)
623 define signext i32 @smax_i32_pos_constant(i32 signext %a) {
624 ; NOZBB-LABEL: smax_i32_pos_constant:
626 ; NOZBB-NEXT: li a1, 10
627 ; NOZBB-NEXT: blt a1, a0, .LBB24_2
628 ; NOZBB-NEXT: # %bb.1:
629 ; NOZBB-NEXT: li a0, 10
630 ; NOZBB-NEXT: .LBB24_2:
633 ; ZBB-LABEL: smax_i32_pos_constant:
635 ; ZBB-NEXT: li a1, 10
636 ; ZBB-NEXT: max a0, a0, a1
638 %c = call i32 @llvm.smax.i32(i32 %a, i32 10)
642 define signext i32 @smax_i32_pos_constant_trailing_zeros(i32 signext %a) {
643 ; NOZBB-LABEL: smax_i32_pos_constant_trailing_zeros:
645 ; NOZBB-NEXT: andi a0, a0, -8
646 ; NOZBB-NEXT: li a1, 16
647 ; NOZBB-NEXT: blt a1, a0, .LBB25_2
648 ; NOZBB-NEXT: # %bb.1:
649 ; NOZBB-NEXT: li a0, 16
650 ; NOZBB-NEXT: .LBB25_2:
653 ; ZBB-LABEL: smax_i32_pos_constant_trailing_zeros:
655 ; ZBB-NEXT: andi a0, a0, -8
656 ; ZBB-NEXT: li a1, 16
657 ; ZBB-NEXT: max a0, a0, a1
660 %c = call i32 @llvm.smax.i32(i32 %b, i32 16)
665 define signext i32 @smin_i32_negone(i32 signext %a) {
666 ; NOZBB-LABEL: smin_i32_negone:
668 ; NOZBB-NEXT: bltz a0, .LBB26_2
669 ; NOZBB-NEXT: # %bb.1:
670 ; NOZBB-NEXT: li a0, -1
671 ; NOZBB-NEXT: .LBB26_2:
674 ; ZBB-LABEL: smin_i32_negone:
676 ; ZBB-NEXT: li a1, -1
677 ; ZBB-NEXT: min a0, a0, a1
679 %c = call i32 @llvm.smin.i32(i32 %a, i32 -1)
683 define i64 @smin_i64_negone(i64 %a) {
684 ; RV32I-LABEL: smin_i64_negone:
686 ; RV32I-NEXT: li a2, -1
687 ; RV32I-NEXT: mv a3, a0
688 ; RV32I-NEXT: bge a1, a2, .LBB27_4
689 ; RV32I-NEXT: # %bb.1:
690 ; RV32I-NEXT: bne a1, a2, .LBB27_5
691 ; RV32I-NEXT: .LBB27_2:
692 ; RV32I-NEXT: bgez a1, .LBB27_6
693 ; RV32I-NEXT: .LBB27_3:
695 ; RV32I-NEXT: .LBB27_4:
696 ; RV32I-NEXT: li a3, -1
697 ; RV32I-NEXT: beq a1, a2, .LBB27_2
698 ; RV32I-NEXT: .LBB27_5:
699 ; RV32I-NEXT: mv a0, a3
700 ; RV32I-NEXT: bltz a1, .LBB27_3
701 ; RV32I-NEXT: .LBB27_6:
702 ; RV32I-NEXT: li a1, -1
705 ; RV64I-LABEL: smin_i64_negone:
707 ; RV64I-NEXT: bltz a0, .LBB27_2
708 ; RV64I-NEXT: # %bb.1:
709 ; RV64I-NEXT: li a0, -1
710 ; RV64I-NEXT: .LBB27_2:
713 ; RV32ZBB-LABEL: smin_i64_negone:
715 ; RV32ZBB-NEXT: li a2, -1
716 ; RV32ZBB-NEXT: mv a3, a0
717 ; RV32ZBB-NEXT: bge a1, a2, .LBB27_3
718 ; RV32ZBB-NEXT: # %bb.1:
719 ; RV32ZBB-NEXT: bne a1, a2, .LBB27_4
720 ; RV32ZBB-NEXT: .LBB27_2:
721 ; RV32ZBB-NEXT: min a1, a1, a2
723 ; RV32ZBB-NEXT: .LBB27_3:
724 ; RV32ZBB-NEXT: li a3, -1
725 ; RV32ZBB-NEXT: beq a1, a2, .LBB27_2
726 ; RV32ZBB-NEXT: .LBB27_4:
727 ; RV32ZBB-NEXT: mv a0, a3
728 ; RV32ZBB-NEXT: min a1, a1, a2
731 ; RV64ZBB-LABEL: smin_i64_negone:
733 ; RV64ZBB-NEXT: li a1, -1
734 ; RV64ZBB-NEXT: min a0, a0, a1
736 %c = call i64 @llvm.smin.i64(i64 %a, i64 -1)