@@ -555,3 +555,167 @@ define i1 @shl1_trunc_sgt4(i32 %a) {
555
555
%r = icmp sgt i16 %t , 4
556
556
ret i1 %r
557
557
}
558
+
559
+ define i1 @eq_nuw (i32 %x ) {
560
+ ; DL64-LABEL: @eq_nuw(
561
+ ; DL64-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 255
562
+ ; DL64-NEXT: [[R:%.*]] = icmp eq i32 [[TMP1]], 123
563
+ ; DL64-NEXT: ret i1 [[R]]
564
+ ;
565
+ ; DL8-LABEL: @eq_nuw(
566
+ ; DL8-NEXT: [[T:%.*]] = trunc nuw i32 [[X:%.*]] to i8
567
+ ; DL8-NEXT: [[R:%.*]] = icmp eq i8 [[T]], 123
568
+ ; DL8-NEXT: ret i1 [[R]]
569
+ ;
570
+ %t = trunc nuw i32 %x to i8
571
+ %r = icmp eq i8 %t , 123
572
+ ret i1 %r
573
+ }
574
+
575
+ define i1 @ult_nuw (i32 %x ) {
576
+ ; CHECK-LABEL: @ult_nuw(
577
+ ; CHECK-NEXT: [[T:%.*]] = trunc nuw i32 [[X:%.*]] to i8
578
+ ; CHECK-NEXT: [[R:%.*]] = icmp ult i8 [[T]], 45
579
+ ; CHECK-NEXT: ret i1 [[R]]
580
+ ;
581
+ %t = trunc nuw i32 %x to i8
582
+ %r = icmp ult i8 %t , 45
583
+ ret i1 %r
584
+ }
585
+
586
+ define i1 @ule_nuw (i32 %x ) {
587
+ ; CHECK-LABEL: @ule_nuw(
588
+ ; CHECK-NEXT: [[T:%.*]] = trunc nuw i32 [[X:%.*]] to i8
589
+ ; CHECK-NEXT: [[R:%.*]] = icmp ult i8 [[T]], 46
590
+ ; CHECK-NEXT: call void @use(i8 [[T]])
591
+ ; CHECK-NEXT: ret i1 [[R]]
592
+ ;
593
+ %t = trunc nuw i32 %x to i8
594
+ %r = icmp ule i8 %t , 45
595
+ call void @use (i8 %t )
596
+ ret i1 %r
597
+ }
598
+
599
+ define i1 @ugt_nuw (i32 %x ) {
600
+ ; CHECK-LABEL: @ugt_nuw(
601
+ ; CHECK-NEXT: [[T:%.*]] = trunc nuw i32 [[X:%.*]] to i8
602
+ ; CHECK-NEXT: [[R:%.*]] = icmp ugt i8 [[T]], 12
603
+ ; CHECK-NEXT: ret i1 [[R]]
604
+ ;
605
+ %t = trunc nuw i32 %x to i8
606
+ %r = icmp ugt i8 %t , 12
607
+ ret i1 %r
608
+ }
609
+
610
+ define i1 @uge_nuw (i48 %x ) {
611
+ ; CHECK-LABEL: @uge_nuw(
612
+ ; CHECK-NEXT: [[T:%.*]] = trunc nuw i48 [[X:%.*]] to i8
613
+ ; CHECK-NEXT: [[R:%.*]] = icmp ugt i8 [[T]], 98
614
+ ; CHECK-NEXT: call void @use(i8 [[T]])
615
+ ; CHECK-NEXT: ret i1 [[R]]
616
+ ;
617
+ %t = trunc nuw i48 %x to i8
618
+ %r = icmp uge i8 %t , 99
619
+ call void @use (i8 %t )
620
+ ret i1 %r
621
+ }
622
+
623
+ define i1 @sgt_nuw_fail (i32 %x ) {
624
+ ; CHECK-LABEL: @sgt_nuw_fail(
625
+ ; CHECK-NEXT: [[T:%.*]] = trunc nuw i32 [[X:%.*]] to i8
626
+ ; CHECK-NEXT: [[R:%.*]] = icmp sgt i8 [[T]], 12
627
+ ; CHECK-NEXT: ret i1 [[R]]
628
+ ;
629
+ %t = trunc nuw i32 %x to i8
630
+ %r = icmp sgt i8 %t , 12
631
+ ret i1 %r
632
+ }
633
+
634
+ define i1 @ne_nsw (i32 %x ) {
635
+ ; DL64-LABEL: @ne_nsw(
636
+ ; DL64-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 255
637
+ ; DL64-NEXT: [[R:%.*]] = icmp ne i32 [[TMP1]], 123
638
+ ; DL64-NEXT: ret i1 [[R]]
639
+ ;
640
+ ; DL8-LABEL: @ne_nsw(
641
+ ; DL8-NEXT: [[T:%.*]] = trunc nsw i32 [[X:%.*]] to i8
642
+ ; DL8-NEXT: [[R:%.*]] = icmp ne i8 [[T]], 123
643
+ ; DL8-NEXT: ret i1 [[R]]
644
+ ;
645
+ %t = trunc nsw i32 %x to i8
646
+ %r = icmp ne i8 %t , 123
647
+ ret i1 %r
648
+ }
649
+
650
+ define i1 @slt_nsw (i32 %x ) {
651
+ ; CHECK-LABEL: @slt_nsw(
652
+ ; CHECK-NEXT: [[T:%.*]] = trunc nsw i32 [[X:%.*]] to i8
653
+ ; CHECK-NEXT: [[R:%.*]] = icmp slt i8 [[T]], 45
654
+ ; CHECK-NEXT: ret i1 [[R]]
655
+ ;
656
+ %t = trunc nsw i32 %x to i8
657
+ %r = icmp slt i8 %t , 45
658
+ ret i1 %r
659
+ }
660
+
661
+ define i1 @sle_nsw (i32 %x ) {
662
+ ; CHECK-LABEL: @sle_nsw(
663
+ ; CHECK-NEXT: [[T:%.*]] = trunc nsw i32 [[X:%.*]] to i8
664
+ ; CHECK-NEXT: [[R:%.*]] = icmp slt i8 [[T]], 46
665
+ ; CHECK-NEXT: call void @use(i8 [[T]])
666
+ ; CHECK-NEXT: ret i1 [[R]]
667
+ ;
668
+ %t = trunc nsw i32 %x to i8
669
+ %r = icmp sle i8 %t , 45
670
+ call void @use (i8 %t )
671
+ ret i1 %r
672
+ }
673
+
674
+ define i1 @sgt_nsw (i32 %x ) {
675
+ ; CHECK-LABEL: @sgt_nsw(
676
+ ; CHECK-NEXT: [[T:%.*]] = trunc nsw i32 [[X:%.*]] to i8
677
+ ; CHECK-NEXT: [[R:%.*]] = icmp sgt i8 [[T]], 12
678
+ ; CHECK-NEXT: ret i1 [[R]]
679
+ ;
680
+ %t = trunc nsw i32 %x to i8
681
+ %r = icmp sgt i8 %t , 12
682
+ ret i1 %r
683
+ }
684
+
685
+ define i1 @sge_nsw (i48 %x ) {
686
+ ; CHECK-LABEL: @sge_nsw(
687
+ ; CHECK-NEXT: [[T:%.*]] = trunc nsw i48 [[X:%.*]] to i8
688
+ ; CHECK-NEXT: [[R:%.*]] = icmp sgt i8 [[T]], 98
689
+ ; CHECK-NEXT: call void @use(i8 [[T]])
690
+ ; CHECK-NEXT: ret i1 [[R]]
691
+ ;
692
+ %t = trunc nsw i48 %x to i8
693
+ %r = icmp sge i8 %t , 99
694
+ call void @use (i8 %t )
695
+ ret i1 %r
696
+ }
697
+
698
+
699
+ define <2 x i1 > @uge_nsw (<2 x i32 > %x ) {
700
+ ; CHECK-LABEL: @uge_nsw(
701
+ ; CHECK-NEXT: [[T:%.*]] = trunc nsw <2 x i32> [[X:%.*]] to <2 x i8>
702
+ ; CHECK-NEXT: [[R:%.*]] = icmp ugt <2 x i8> [[T]], <i8 44, i8 44>
703
+ ; CHECK-NEXT: ret <2 x i1> [[R]]
704
+ ;
705
+ %t = trunc nsw <2 x i32 > %x to <2 x i8 >
706
+ %r = icmp uge <2 x i8 > %t , <i8 45 , i8 45 >
707
+ ret <2 x i1 > %r
708
+ }
709
+
710
+
711
+ define <2 x i1 > @uge_nsw_non_splat (<2 x i32 > %x ) {
712
+ ; CHECK-LABEL: @uge_nsw_non_splat(
713
+ ; CHECK-NEXT: [[T:%.*]] = trunc nsw <2 x i32> [[X:%.*]] to <2 x i8>
714
+ ; CHECK-NEXT: [[R:%.*]] = icmp ugt <2 x i8> [[T]], <i8 44, i8 45>
715
+ ; CHECK-NEXT: ret <2 x i1> [[R]]
716
+ ;
717
+ %t = trunc nsw <2 x i32 > %x to <2 x i8 >
718
+ %r = icmp uge <2 x i8 > %t , <i8 45 , i8 46 >
719
+ ret <2 x i1 > %r
720
+ }
721
+
0 commit comments