@@ -555,3 +555,195 @@ 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 (i32 %x ) {
611
+ ; CHECK-LABEL: @uge_nuw(
612
+ ; CHECK-NEXT: [[T:%.*]] = trunc nuw i32 [[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 i32 %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 @uge_nuw_i48 (i48 %x ) {
624
+ ; CHECK-LABEL: @uge_nuw_i48(
625
+ ; CHECK-NEXT: [[T:%.*]] = trunc nuw i48 [[X:%.*]] to i8
626
+ ; CHECK-NEXT: [[R:%.*]] = icmp ugt i8 [[T]], 98
627
+ ; CHECK-NEXT: call void @use(i8 [[T]])
628
+ ; CHECK-NEXT: ret i1 [[R]]
629
+ ;
630
+ %t = trunc nuw i48 %x to i8
631
+ %r = icmp uge i8 %t , 99
632
+ call void @use (i8 %t )
633
+ ret i1 %r
634
+ }
635
+
636
+ define i1 @sgt_nuw_fail (i32 %x ) {
637
+ ; CHECK-LABEL: @sgt_nuw_fail(
638
+ ; CHECK-NEXT: [[T:%.*]] = trunc nuw i32 [[X:%.*]] to i8
639
+ ; CHECK-NEXT: [[R:%.*]] = icmp sgt i8 [[T]], 12
640
+ ; CHECK-NEXT: ret i1 [[R]]
641
+ ;
642
+ %t = trunc nuw i32 %x to i8
643
+ %r = icmp sgt i8 %t , 12
644
+ ret i1 %r
645
+ }
646
+
647
+ define i1 @ne_nsw (i32 %x ) {
648
+ ; DL64-LABEL: @ne_nsw(
649
+ ; DL64-NEXT: [[TMP1:%.*]] = and i32 [[X:%.*]], 255
650
+ ; DL64-NEXT: [[R:%.*]] = icmp ne i32 [[TMP1]], 133
651
+ ; DL64-NEXT: ret i1 [[R]]
652
+ ;
653
+ ; DL8-LABEL: @ne_nsw(
654
+ ; DL8-NEXT: [[T:%.*]] = trunc nsw i32 [[X:%.*]] to i8
655
+ ; DL8-NEXT: [[R:%.*]] = icmp ne i8 [[T]], -123
656
+ ; DL8-NEXT: ret i1 [[R]]
657
+ ;
658
+ %t = trunc nsw i32 %x to i8
659
+ %r = icmp ne i8 %t , -123
660
+ ret i1 %r
661
+ }
662
+
663
+ define i1 @slt_nsw (i32 %x ) {
664
+ ; CHECK-LABEL: @slt_nsw(
665
+ ; CHECK-NEXT: [[T:%.*]] = trunc nsw i32 [[X:%.*]] to i8
666
+ ; CHECK-NEXT: [[R:%.*]] = icmp slt i8 [[T]], 45
667
+ ; CHECK-NEXT: ret i1 [[R]]
668
+ ;
669
+ %t = trunc nsw i32 %x to i8
670
+ %r = icmp slt i8 %t , 45
671
+ ret i1 %r
672
+ }
673
+
674
+ define i1 @sle_nsw (i16 %x ) {
675
+ ; CHECK-LABEL: @sle_nsw(
676
+ ; CHECK-NEXT: [[T:%.*]] = trunc nsw i16 [[X:%.*]] to i8
677
+ ; CHECK-NEXT: [[R:%.*]] = icmp slt i8 [[T]], 46
678
+ ; CHECK-NEXT: call void @use(i8 [[T]])
679
+ ; CHECK-NEXT: ret i1 [[R]]
680
+ ;
681
+ %t = trunc nsw i16 %x to i8
682
+ %r = icmp sle i8 %t , 45
683
+ call void @use (i8 %t )
684
+ ret i1 %r
685
+ }
686
+
687
+ define i1 @sgt_nsw (i32 %x ) {
688
+ ; CHECK-LABEL: @sgt_nsw(
689
+ ; CHECK-NEXT: [[T:%.*]] = trunc nsw i32 [[X:%.*]] to i8
690
+ ; CHECK-NEXT: [[R:%.*]] = icmp sgt i8 [[T]], -12
691
+ ; CHECK-NEXT: ret i1 [[R]]
692
+ ;
693
+ %t = trunc nsw i32 %x to i8
694
+ %r = icmp sgt i8 %t , -12
695
+ ret i1 %r
696
+ }
697
+
698
+ define i1 @sge_nsw (i64 %x ) {
699
+ ; CHECK-LABEL: @sge_nsw(
700
+ ; CHECK-NEXT: [[T:%.*]] = trunc nsw i64 [[X:%.*]] to i8
701
+ ; CHECK-NEXT: [[R:%.*]] = icmp sgt i8 [[T]], 98
702
+ ; CHECK-NEXT: call void @use(i8 [[T]])
703
+ ; CHECK-NEXT: ret i1 [[R]]
704
+ ;
705
+ %t = trunc nsw i64 %x to i8
706
+ %r = icmp sge i8 %t , 99
707
+ call void @use (i8 %t )
708
+ ret i1 %r
709
+ }
710
+
711
+
712
+
713
+ define i1 @sge_nsw_i48 (i48 %x ) {
714
+ ; CHECK-LABEL: @sge_nsw_i48(
715
+ ; CHECK-NEXT: [[T:%.*]] = trunc nsw i48 [[X:%.*]] to i8
716
+ ; CHECK-NEXT: [[R:%.*]] = icmp sgt i8 [[T]], 98
717
+ ; CHECK-NEXT: call void @use(i8 [[T]])
718
+ ; CHECK-NEXT: ret i1 [[R]]
719
+ ;
720
+ %t = trunc nsw i48 %x to i8
721
+ %r = icmp sge i8 %t , 99
722
+ call void @use (i8 %t )
723
+ ret i1 %r
724
+ }
725
+
726
+
727
+ define <2 x i1 > @uge_nsw (<2 x i32 > %x ) {
728
+ ; CHECK-LABEL: @uge_nsw(
729
+ ; CHECK-NEXT: [[T:%.*]] = trunc nsw <2 x i32> [[X:%.*]] to <2 x i8>
730
+ ; CHECK-NEXT: [[R:%.*]] = icmp ugt <2 x i8> [[T]], <i8 -46, i8 -46>
731
+ ; CHECK-NEXT: ret <2 x i1> [[R]]
732
+ ;
733
+ %t = trunc nsw <2 x i32 > %x to <2 x i8 >
734
+ %r = icmp uge <2 x i8 > %t , <i8 -45 , i8 -45 >
735
+ ret <2 x i1 > %r
736
+ }
737
+
738
+
739
+ define <2 x i1 > @uge_nsw_non_splat (<2 x i32 > %x ) {
740
+ ; CHECK-LABEL: @uge_nsw_non_splat(
741
+ ; CHECK-NEXT: [[T:%.*]] = trunc nsw <2 x i32> [[X:%.*]] to <2 x i8>
742
+ ; CHECK-NEXT: [[R:%.*]] = icmp ugt <2 x i8> [[T]], <i8 44, i8 45>
743
+ ; CHECK-NEXT: ret <2 x i1> [[R]]
744
+ ;
745
+ %t = trunc nsw <2 x i32 > %x to <2 x i8 >
746
+ %r = icmp uge <2 x i8 > %t , <i8 45 , i8 46 >
747
+ ret <2 x i1 > %r
748
+ }
749
+
0 commit comments