1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \
3 ; RUN: | FileCheck %s -check-prefix=RV64I
5 define i64 @icmp_eq(i64 %a, i64 %b) nounwind {
6 ; RV64I-LABEL: icmp_eq:
8 ; RV64I-NEXT: xor a0, a0, a1
9 ; RV64I-NEXT: seqz a0, a0
11 %1 = icmp eq i64 %a, %b
12 %2 = zext i1 %1 to i64
16 define i64 @icmp_eq_constant(i64 %a) nounwind {
17 ; RV64I-LABEL: icmp_eq_constant:
19 ; RV64I-NEXT: addi a0, a0, -42
20 ; RV64I-NEXT: seqz a0, a0
22 %1 = icmp eq i64 %a, 42
23 %2 = zext i1 %1 to i64
27 define i64 @icmp_eq_constant_2049(i64 %a) nounwind {
28 ; RV64I-LABEL: icmp_eq_constant_2049:
30 ; RV64I-NEXT: lui a1, 1
31 ; RV64I-NEXT: addiw a1, a1, -2047
32 ; RV64I-NEXT: xor a0, a0, a1
33 ; RV64I-NEXT: seqz a0, a0
35 %1 = icmp eq i64 %a, 2049
36 %2 = zext i1 %1 to i64
40 define i64 @icmp_eq_constant_2048(i64 %a) nounwind {
41 ; RV64I-LABEL: icmp_eq_constant_2048:
43 ; RV64I-NEXT: addi a0, a0, -2048
44 ; RV64I-NEXT: seqz a0, a0
46 %1 = icmp eq i64 %a, 2048
47 %2 = zext i1 %1 to i64
51 define i64 @icmp_eq_constant_neg_2048(i64 %a) nounwind {
52 ; RV64I-LABEL: icmp_eq_constant_neg_2048:
54 ; RV64I-NEXT: xori a0, a0, -2048
55 ; RV64I-NEXT: seqz a0, a0
57 %1 = icmp eq i64 %a, -2048
58 %2 = zext i1 %1 to i64
62 define i64 @icmp_eq_constant_neg_2047(i64 %a) nounwind {
63 ; RV64I-LABEL: icmp_eq_constant_neg_2047:
65 ; RV64I-NEXT: addi a0, a0, 2047
66 ; RV64I-NEXT: seqz a0, a0
68 %1 = icmp eq i64 %a, -2047
69 %2 = zext i1 %1 to i64
73 define i64 @icmp_eqz(i64 %a) nounwind {
74 ; RV64I-LABEL: icmp_eqz:
76 ; RV64I-NEXT: seqz a0, a0
78 %1 = icmp eq i64 %a, 0
79 %2 = zext i1 %1 to i64
83 define i64 @icmp_ne(i64 %a, i64 %b) nounwind {
84 ; RV64I-LABEL: icmp_ne:
86 ; RV64I-NEXT: xor a0, a0, a1
87 ; RV64I-NEXT: snez a0, a0
89 %1 = icmp ne i64 %a, %b
90 %2 = zext i1 %1 to i64
94 define i64 @icmp_ne_constant(i64 %a) nounwind {
95 ; RV64I-LABEL: icmp_ne_constant:
97 ; RV64I-NEXT: addi a0, a0, -42
98 ; RV64I-NEXT: snez a0, a0
100 %1 = icmp ne i64 %a, 42
101 %2 = zext i1 %1 to i64
105 define i64 @icmp_ne_constant_2049(i64 %a) nounwind {
106 ; RV64I-LABEL: icmp_ne_constant_2049:
108 ; RV64I-NEXT: lui a1, 1
109 ; RV64I-NEXT: addiw a1, a1, -2047
110 ; RV64I-NEXT: xor a0, a0, a1
111 ; RV64I-NEXT: snez a0, a0
113 %1 = icmp ne i64 %a, 2049
114 %2 = zext i1 %1 to i64
118 define i64 @icmp_ne_constant_2048(i64 %a) nounwind {
119 ; RV64I-LABEL: icmp_ne_constant_2048:
121 ; RV64I-NEXT: addi a0, a0, -2048
122 ; RV64I-NEXT: snez a0, a0
124 %1 = icmp ne i64 %a, 2048
125 %2 = zext i1 %1 to i64
129 define i64 @icmp_ne_constant_neg_2048(i64 %a) nounwind {
130 ; RV64I-LABEL: icmp_ne_constant_neg_2048:
132 ; RV64I-NEXT: xori a0, a0, -2048
133 ; RV64I-NEXT: snez a0, a0
135 %1 = icmp ne i64 %a, -2048
136 %2 = zext i1 %1 to i64
140 define i64 @icmp_ne_constant_neg_2047(i64 %a) nounwind {
141 ; RV64I-LABEL: icmp_ne_constant_neg_2047:
143 ; RV64I-NEXT: addi a0, a0, 2047
144 ; RV64I-NEXT: snez a0, a0
146 %1 = icmp ne i64 %a, -2047
147 %2 = zext i1 %1 to i64
151 define i64 @icmp_nez(i64 %a) nounwind {
152 ; RV64I-LABEL: icmp_nez:
154 ; RV64I-NEXT: snez a0, a0
156 %1 = icmp ne i64 %a, 0
157 %2 = zext i1 %1 to i64
161 define i64 @icmp_ne_neg_1(i64 %a) nounwind {
162 ; RV64I-LABEL: icmp_ne_neg_1:
164 ; RV64I-NEXT: sltiu a0, a0, -1
166 %1 = icmp ne i64 %a, -1
167 %2 = zext i1 %1 to i64
171 define i64 @icmp_ugt(i64 %a, i64 %b) nounwind {
172 ; RV64I-LABEL: icmp_ugt:
174 ; RV64I-NEXT: sltu a0, a1, a0
176 %1 = icmp ugt i64 %a, %b
177 %2 = zext i1 %1 to i64
181 define i64 @icmp_ugt_constant_zero(i64 %a) nounwind {
182 ; RV64I-LABEL: icmp_ugt_constant_zero:
184 ; RV64I-NEXT: snez a0, a0
186 %1 = icmp ugt i64 %a, 0
187 %2 = zext i1 %1 to i64
191 define i64 @icmp_ugt_constant_2047(i64 %a) nounwind {
192 ; RV64I-LABEL: icmp_ugt_constant_2047:
194 ; RV64I-NEXT: li a1, 2047
195 ; RV64I-NEXT: sltu a0, a1, a0
197 %1 = icmp ugt i64 %a, 2047
198 %2 = zext i1 %1 to i64
202 define i64 @icmp_ugt_constant_2046(i64 %a) nounwind {
203 ; RV64I-LABEL: icmp_ugt_constant_2046:
205 ; RV64I-NEXT: sltiu a0, a0, 2047
206 ; RV64I-NEXT: xori a0, a0, 1
208 %1 = icmp ugt i64 %a, 2046
209 %2 = zext i1 %1 to i64
213 define i64 @icmp_ugt_constant_neg_2049(i64 %a) nounwind {
214 ; RV64I-LABEL: icmp_ugt_constant_neg_2049:
216 ; RV64I-NEXT: sltiu a0, a0, -2048
217 ; RV64I-NEXT: xori a0, a0, 1
219 ; 18446744073709549567 signed extend is -2049
220 %1 = icmp ugt i64 %a, 18446744073709549567
221 %2 = zext i1 %1 to i64
225 define i64 @icmp_ugt_constant_neg_2050(i64 %a) nounwind {
226 ; RV64I-LABEL: icmp_ugt_constant_neg_2050:
228 ; RV64I-NEXT: lui a1, 1048575
229 ; RV64I-NEXT: addiw a1, a1, 2046
230 ; RV64I-NEXT: sltu a0, a1, a0
232 ; 18446744073709549566 signed extend is -2050
233 %1 = icmp ugt i64 %a, 18446744073709549566
234 %2 = zext i1 %1 to i64
238 define i64 @icmp_uge(i64 %a, i64 %b) nounwind {
239 ; RV64I-LABEL: icmp_uge:
241 ; RV64I-NEXT: sltu a0, a0, a1
242 ; RV64I-NEXT: xori a0, a0, 1
244 %1 = icmp uge i64 %a, %b
245 %2 = zext i1 %1 to i64
249 define i64 @icmp_uge_constant_zero(i64 %a) nounwind {
250 ; RV64I-LABEL: icmp_uge_constant_zero:
252 ; RV64I-NEXT: li a0, 1
254 %1 = icmp uge i64 %a, 0
255 %2 = zext i1 %1 to i64
259 define i64 @icmp_uge_constant_2047(i64 %a) nounwind {
260 ; RV64I-LABEL: icmp_uge_constant_2047:
262 ; RV64I-NEXT: sltiu a0, a0, 2047
263 ; RV64I-NEXT: xori a0, a0, 1
265 %1 = icmp uge i64 %a, 2047
266 %2 = zext i1 %1 to i64
270 define i64 @icmp_uge_constant_2048(i64 %a) nounwind {
271 ; RV64I-LABEL: icmp_uge_constant_2048:
273 ; RV64I-NEXT: li a1, 2047
274 ; RV64I-NEXT: sltu a0, a1, a0
276 %1 = icmp uge i64 %a, 2048
277 %2 = zext i1 %1 to i64
281 define i64 @icmp_uge_constant_neg_2048(i64 %a) nounwind {
282 ; RV64I-LABEL: icmp_uge_constant_neg_2048:
284 ; RV64I-NEXT: sltiu a0, a0, -2048
285 ; RV64I-NEXT: xori a0, a0, 1
287 ; 18446744073709549568 signed extend is -2048
288 %1 = icmp uge i64 %a, 18446744073709549568
289 %2 = zext i1 %1 to i64
293 define i64 @icmp_uge_constant_neg_2049(i64 %a) nounwind {
294 ; RV64I-LABEL: icmp_uge_constant_neg_2049:
296 ; RV64I-NEXT: lui a1, 1048575
297 ; RV64I-NEXT: addiw a1, a1, 2046
298 ; RV64I-NEXT: sltu a0, a1, a0
300 ; 18446744073709549567 signed extend is -2049
301 %1 = icmp uge i64 %a, 18446744073709549567
302 %2 = zext i1 %1 to i64
306 define i64 @icmp_ult(i64 %a, i64 %b) nounwind {
307 ; RV64I-LABEL: icmp_ult:
309 ; RV64I-NEXT: sltu a0, a0, a1
311 %1 = icmp ult i64 %a, %b
312 %2 = zext i1 %1 to i64
316 define i64 @icmp_ult_constant_zero(i64 %a) nounwind {
317 ; RV64I-LABEL: icmp_ult_constant_zero:
319 ; RV64I-NEXT: li a0, 0
321 %1 = icmp ult i64 %a, 0
322 %2 = zext i1 %1 to i64
326 define i64 @icmp_ult_constant_2047(i64 %a) nounwind {
327 ; RV64I-LABEL: icmp_ult_constant_2047:
329 ; RV64I-NEXT: sltiu a0, a0, 2047
331 %1 = icmp ult i64 %a, 2047
332 %2 = zext i1 %1 to i64
336 define i64 @icmp_ult_constant_2048(i64 %a) nounwind {
337 ; RV64I-LABEL: icmp_ult_constant_2048:
339 ; RV64I-NEXT: srli a0, a0, 11
340 ; RV64I-NEXT: seqz a0, a0
342 %1 = icmp ult i64 %a, 2048
343 %2 = zext i1 %1 to i64
347 define i64 @icmp_ult_constant_neg_2048(i64 %a) nounwind {
348 ; RV64I-LABEL: icmp_ult_constant_neg_2048:
350 ; RV64I-NEXT: sltiu a0, a0, -2048
352 ; 18446744073709549568 signed extend is -2048
353 %1 = icmp ult i64 %a, 18446744073709549568
354 %2 = zext i1 %1 to i64
358 define i64 @icmp_ult_constant_neg_2049(i64 %a) nounwind {
359 ; RV64I-LABEL: icmp_ult_constant_neg_2049:
361 ; RV64I-NEXT: lui a1, 1048575
362 ; RV64I-NEXT: addiw a1, a1, 2047
363 ; RV64I-NEXT: sltu a0, a0, a1
365 ; 18446744073709549567 signed extend is -2049
366 %1 = icmp ult i64 %a, 18446744073709549567
367 %2 = zext i1 %1 to i64
371 define i64 @icmp_ule(i64 %a, i64 %b) nounwind {
372 ; RV64I-LABEL: icmp_ule:
374 ; RV64I-NEXT: sltu a0, a1, a0
375 ; RV64I-NEXT: xori a0, a0, 1
377 %1 = icmp ule i64 %a, %b
378 %2 = zext i1 %1 to i64
382 define i64 @icmp_ule_constant_zero(i64 %a) nounwind {
383 ; RV64I-LABEL: icmp_ule_constant_zero:
385 ; RV64I-NEXT: seqz a0, a0
387 %1 = icmp ule i64 %a, 0
388 %2 = zext i1 %1 to i64
392 define i64 @icmp_ule_constant_2046(i64 %a) nounwind {
393 ; RV64I-LABEL: icmp_ule_constant_2046:
395 ; RV64I-NEXT: sltiu a0, a0, 2047
397 %1 = icmp ule i64 %a, 2046
398 %2 = zext i1 %1 to i64
402 define i64 @icmp_ule_constant_2047(i64 %a) nounwind {
403 ; RV64I-LABEL: icmp_ule_constant_2047:
405 ; RV64I-NEXT: srli a0, a0, 11
406 ; RV64I-NEXT: seqz a0, a0
408 %1 = icmp ule i64 %a, 2047
409 %2 = zext i1 %1 to i64
413 define i64 @icmp_ule_constant_neg_2049(i64 %a) nounwind {
414 ; RV64I-LABEL: icmp_ule_constant_neg_2049:
416 ; RV64I-NEXT: sltiu a0, a0, -2048
418 ; 18446744073709549567 signed extend is -2049
419 %1 = icmp ule i64 %a, 18446744073709549567
420 %2 = zext i1 %1 to i64
424 define i64 @icmp_ule_constant_neg_2050(i64 %a) nounwind {
425 ; RV64I-LABEL: icmp_ule_constant_neg_2050:
427 ; RV64I-NEXT: lui a1, 1048575
428 ; RV64I-NEXT: addiw a1, a1, 2047
429 ; RV64I-NEXT: sltu a0, a0, a1
431 ; 18446744073709549566 signed extend is -2050
432 %1 = icmp ule i64 %a, 18446744073709549566
433 %2 = zext i1 %1 to i64
437 define i64 @icmp_sgt(i64 %a, i64 %b) nounwind {
438 ; RV64I-LABEL: icmp_sgt:
440 ; RV64I-NEXT: slt a0, a1, a0
442 %1 = icmp sgt i64 %a, %b
443 %2 = zext i1 %1 to i64
447 define i64 @icmp_sgt_constant_zero(i64 %a) nounwind {
448 ; RV64I-LABEL: icmp_sgt_constant_zero:
450 ; RV64I-NEXT: sgtz a0, a0
452 %1 = icmp sgt i64 %a, 0
453 %2 = zext i1 %1 to i64
457 define i64 @icmp_sgt_constant_2046(i64 %a) nounwind {
458 ; RV64I-LABEL: icmp_sgt_constant_2046:
460 ; RV64I-NEXT: slti a0, a0, 2047
461 ; RV64I-NEXT: xori a0, a0, 1
463 %1 = icmp sgt i64 %a, 2046
464 %2 = zext i1 %1 to i64
468 define i64 @icmp_sgt_constant_2047(i64 %a) nounwind {
469 ; RV64I-LABEL: icmp_sgt_constant_2047:
471 ; RV64I-NEXT: li a1, 2047
472 ; RV64I-NEXT: slt a0, a1, a0
474 %1 = icmp sgt i64 %a, 2047
475 %2 = zext i1 %1 to i64
479 define i64 @icmp_sgt_constant_neg_2049(i64 %a) nounwind {
480 ; RV64I-LABEL: icmp_sgt_constant_neg_2049:
482 ; RV64I-NEXT: slti a0, a0, -2048
483 ; RV64I-NEXT: xori a0, a0, 1
485 %1 = icmp sgt i64 %a, -2049
486 %2 = zext i1 %1 to i64
490 define i64 @icmp_sgt_constant_neg_2050(i64 %a) nounwind {
491 ; RV64I-LABEL: icmp_sgt_constant_neg_2050:
493 ; RV64I-NEXT: lui a1, 1048575
494 ; RV64I-NEXT: addiw a1, a1, 2046
495 ; RV64I-NEXT: slt a0, a1, a0
497 %1 = icmp sgt i64 %a, -2050
498 %2 = zext i1 %1 to i64
502 define i64 @icmp_sge(i64 %a, i64 %b) nounwind {
503 ; RV64I-LABEL: icmp_sge:
505 ; RV64I-NEXT: slt a0, a0, a1
506 ; RV64I-NEXT: xori a0, a0, 1
508 %1 = icmp sge i64 %a, %b
509 %2 = zext i1 %1 to i64
513 define i64 @icmp_sge_constant_zero(i64 %a) nounwind {
514 ; RV64I-LABEL: icmp_sge_constant_zero:
516 ; RV64I-NEXT: not a0, a0
517 ; RV64I-NEXT: srli a0, a0, 63
519 %1 = icmp sge i64 %a, 0
520 %2 = zext i1 %1 to i64
524 define i64 @icmp_sge_constant_2047(i64 %a) nounwind {
525 ; RV64I-LABEL: icmp_sge_constant_2047:
527 ; RV64I-NEXT: slti a0, a0, 2047
528 ; RV64I-NEXT: xori a0, a0, 1
530 %1 = icmp sge i64 %a, 2047
531 %2 = zext i1 %1 to i64
535 define i64 @icmp_sge_constant_2048(i64 %a) nounwind {
536 ; RV64I-LABEL: icmp_sge_constant_2048:
538 ; RV64I-NEXT: li a1, 2047
539 ; RV64I-NEXT: slt a0, a1, a0
541 %1 = icmp sge i64 %a, 2048
542 %2 = zext i1 %1 to i64
546 define i64 @icmp_sge_constant_neg_2047(i64 %a) nounwind {
547 ; RV64I-LABEL: icmp_sge_constant_neg_2047:
549 ; RV64I-NEXT: slti a0, a0, -2047
550 ; RV64I-NEXT: xori a0, a0, 1
552 %1 = icmp sge i64 %a, -2047
553 %2 = zext i1 %1 to i64
557 define i64 @icmp_sge_constant_neg_2048(i64 %a) nounwind {
558 ; RV64I-LABEL: icmp_sge_constant_neg_2048:
560 ; RV64I-NEXT: not a0, a0
561 ; RV64I-NEXT: srli a0, a0, 63
563 %1 = icmp sge i64 %a, 0
564 %2 = zext i1 %1 to i64
568 define i64 @icmp_slt(i64 %a, i64 %b) nounwind {
569 ; RV64I-LABEL: icmp_slt:
571 ; RV64I-NEXT: slt a0, a0, a1
573 %1 = icmp slt i64 %a, %b
574 %2 = zext i1 %1 to i64
578 define i64 @icmp_slt_constant_zero(i64 %a) nounwind {
579 ; RV64I-LABEL: icmp_slt_constant_zero:
581 ; RV64I-NEXT: srli a0, a0, 63
583 %1 = icmp slt i64 %a, 0
584 %2 = zext i1 %1 to i64
588 define i64 @icmp_slt_constant_2047(i64 %a) nounwind {
589 ; RV64I-LABEL: icmp_slt_constant_2047:
591 ; RV64I-NEXT: slti a0, a0, 2047
593 %1 = icmp slt i64 %a, 2047
594 %2 = zext i1 %1 to i64
598 define i64 @icmp_slt_constant_2048(i64 %a) nounwind {
599 ; RV64I-LABEL: icmp_slt_constant_2048:
601 ; RV64I-NEXT: li a1, 1
602 ; RV64I-NEXT: slli a1, a1, 11
603 ; RV64I-NEXT: slt a0, a0, a1
605 %1 = icmp slt i64 %a, 2048
606 %2 = zext i1 %1 to i64
610 define i64 @icmp_slt_constant_neg_2048(i64 %a) nounwind {
611 ; RV64I-LABEL: icmp_slt_constant_neg_2048:
613 ; RV64I-NEXT: slti a0, a0, -2048
615 %1 = icmp slt i64 %a, -2048
616 %2 = zext i1 %1 to i64
620 define i64 @icmp_slt_constant_neg_2049(i64 %a) nounwind {
621 ; RV64I-LABEL: icmp_slt_constant_neg_2049:
623 ; RV64I-NEXT: lui a1, 1048575
624 ; RV64I-NEXT: addiw a1, a1, 2047
625 ; RV64I-NEXT: slt a0, a0, a1
627 %1 = icmp slt i64 %a, -2049
628 %2 = zext i1 %1 to i64
632 define i64 @icmp_sle(i64 %a, i64 %b) nounwind {
633 ; RV64I-LABEL: icmp_sle:
635 ; RV64I-NEXT: slt a0, a1, a0
636 ; RV64I-NEXT: xori a0, a0, 1
638 %1 = icmp sle i64 %a, %b
639 %2 = zext i1 %1 to i64
643 define i64 @icmp_sle_constant_zero(i64 %a) nounwind {
644 ; RV64I-LABEL: icmp_sle_constant_zero:
646 ; RV64I-NEXT: slti a0, a0, 1
648 %1 = icmp sle i64 %a, 0
649 %2 = zext i1 %1 to i64
653 define i64 @icmp_sle_constant_2046(i64 %a) nounwind {
654 ; RV64I-LABEL: icmp_sle_constant_2046:
656 ; RV64I-NEXT: slti a0, a0, 2047
658 %1 = icmp sle i64 %a, 2046
659 %2 = zext i1 %1 to i64
663 define i64 @icmp_sle_constant_2047(i64 %a) nounwind {
664 ; RV64I-LABEL: icmp_sle_constant_2047:
666 ; RV64I-NEXT: li a1, 1
667 ; RV64I-NEXT: slli a1, a1, 11
668 ; RV64I-NEXT: slt a0, a0, a1
670 %1 = icmp sle i64 %a, 2047
671 %2 = zext i1 %1 to i64
675 define i64 @icmp_sle_constant_neg_2049(i64 %a) nounwind {
676 ; RV64I-LABEL: icmp_sle_constant_neg_2049:
678 ; RV64I-NEXT: slti a0, a0, -2048
680 %1 = icmp sle i64 %a, -2049
681 %2 = zext i1 %1 to i64
685 define i64 @icmp_sle_constant_neg_2050(i64 %a) nounwind {
686 ; RV64I-LABEL: icmp_sle_constant_neg_2050:
688 ; RV64I-NEXT: lui a1, 1048575
689 ; RV64I-NEXT: addiw a1, a1, 2047
690 ; RV64I-NEXT: slt a0, a0, a1
692 %1 = icmp sle i64 %a, -2050
693 %2 = zext i1 %1 to i64
697 define i64 @icmp_eq_zext_inreg_small_constant(i64 %a) nounwind {
698 ; RV64I-LABEL: icmp_eq_zext_inreg_small_constant:
700 ; RV64I-NEXT: sext.w a0, a0
701 ; RV64I-NEXT: addi a0, a0, -123
702 ; RV64I-NEXT: seqz a0, a0
704 %1 = and i64 %a, 4294967295
705 %2 = icmp eq i64 %1, 123
706 %3 = zext i1 %2 to i64
710 define i64 @icmp_eq_zext_inreg_large_constant(i64 %a) nounwind {
711 ; RV64I-LABEL: icmp_eq_zext_inreg_large_constant:
713 ; RV64I-NEXT: sext.w a0, a0
714 ; RV64I-NEXT: lui a1, 563901
715 ; RV64I-NEXT: addiw a1, a1, -529
716 ; RV64I-NEXT: xor a0, a0, a1
717 ; RV64I-NEXT: seqz a0, a0
719 %1 = and i64 %a, 4294967295
720 %2 = icmp eq i64 %1, 2309737967
721 %3 = zext i1 %2 to i64
725 define i64 @icmp_ne_zext_inreg_small_constant(i64 %a) nounwind {
726 ; RV64I-LABEL: icmp_ne_zext_inreg_small_constant:
728 ; RV64I-NEXT: sext.w a0, a0
729 ; RV64I-NEXT: snez a0, a0
731 %1 = and i64 %a, 4294967295
732 %2 = icmp ne i64 %1, 0
733 %3 = zext i1 %2 to i64
737 define i64 @icmp_ne_zext_inreg_large_constant(i64 %a) nounwind {
738 ; RV64I-LABEL: icmp_ne_zext_inreg_large_constant:
740 ; RV64I-NEXT: sext.w a0, a0
741 ; RV64I-NEXT: addi a0, a0, 2
742 ; RV64I-NEXT: snez a0, a0
744 %1 = and i64 %a, 4294967295
745 %2 = icmp ne i64 %1, 4294967294
746 %3 = zext i1 %2 to i64
750 ; This used to trigger an infinite loop where we toggled between 'and' and
752 define i64 @icmp_ne_zext_inreg_umin(i64 %a) nounwind {
753 ; RV64I-LABEL: icmp_ne_zext_inreg_umin:
755 ; RV64I-NEXT: lui a1, 30141
756 ; RV64I-NEXT: addiw a1, a1, -747
757 ; RV64I-NEXT: bltu a0, a1, .LBB67_2
758 ; RV64I-NEXT: # %bb.1:
759 ; RV64I-NEXT: mv a0, a1
760 ; RV64I-NEXT: .LBB67_2:
761 ; RV64I-NEXT: addi a0, a0, -123
762 ; RV64I-NEXT: snez a0, a0
764 %1 = call i64 @llvm.umin.i64(i64 %a, i64 123456789)
765 %2 = and i64 %1, 4294967295
766 %3 = icmp ne i64 %2, 123
767 %4 = zext i1 %3 to i64
770 declare i64 @llvm.umin.i64(i64, i64)