@@ -706,11 +706,10 @@ define <2 x i32> @uadd_sat_ugt_commute_add(<2 x i32> %xp, <2 x i32> %yp) {
706
706
define i32 @uadd_sat_commute_select (i32 %x , i32 %yp ) {
707
707
; CHECK-LABEL: @uadd_sat_commute_select(
708
708
; CHECK-NEXT: [[Y:%.*]] = sdiv i32 [[YP:%.*]], 2442
709
- ; CHECK-NEXT: [[NOTX:%.*]] = xor i32 [[X:%.*]], -1
710
- ; CHECK-NEXT: [[A:%.*]] = add i32 [[Y]], [[X]]
711
- ; CHECK-NEXT: [[C:%.*]] = icmp ult i32 [[Y]], [[NOTX]]
712
- ; CHECK-NEXT: [[R:%.*]] = select i1 [[C]], i32 [[A]], i32 -1
713
- ; CHECK-NEXT: ret i32 [[R]]
709
+ ; CHECK-NEXT: [[A:%.*]] = add i32 [[Y]], [[X:%.*]]
710
+ ; CHECK-NEXT: [[TMP1:%.*]] = icmp ult i32 [[A]], [[Y]]
711
+ ; CHECK-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 -1, i32 [[A]]
712
+ ; CHECK-NEXT: ret i32 [[TMP2]]
714
713
;
715
714
%y = sdiv i32 %yp , 2442 ; thwart complexity-based-canonicalization
716
715
%notx = xor i32 %x , -1
@@ -724,11 +723,10 @@ define i32 @uadd_sat_commute_select_commute_add(i32 %xp, i32 %yp) {
724
723
; CHECK-LABEL: @uadd_sat_commute_select_commute_add(
725
724
; CHECK-NEXT: [[X:%.*]] = urem i32 42, [[XP:%.*]]
726
725
; CHECK-NEXT: [[Y:%.*]] = sdiv i32 [[YP:%.*]], 2442
727
- ; CHECK-NEXT: [[NOTX:%.*]] = xor i32 [[X]], -1
728
726
; CHECK-NEXT: [[A:%.*]] = add nsw i32 [[X]], [[Y]]
729
- ; CHECK-NEXT: [[C :%.*]] = icmp ult i32 [[Y ]], [[NOTX ]]
730
- ; CHECK-NEXT: [[R :%.*]] = select i1 [[C ]], i32 [[A]], i32 -1
731
- ; CHECK-NEXT: ret i32 [[R ]]
727
+ ; CHECK-NEXT: [[TMP1 :%.*]] = icmp ult i32 [[A ]], [[Y ]]
728
+ ; CHECK-NEXT: [[TMP2 :%.*]] = select i1 [[TMP1 ]], i32 -1, i32 [[A]]
729
+ ; CHECK-NEXT: ret i32 [[TMP2 ]]
732
730
;
733
731
%x = urem i32 42 , %xp ; thwart complexity-based-canonicalization
734
732
%y = sdiv i32 %yp , 2442 ; thwart complexity-based-canonicalization
@@ -741,11 +739,10 @@ define i32 @uadd_sat_commute_select_commute_add(i32 %xp, i32 %yp) {
741
739
742
740
define <2 x i32 > @uadd_sat_commute_select_ugt (<2 x i32 > %x , <2 x i32 > %y ) {
743
741
; CHECK-LABEL: @uadd_sat_commute_select_ugt(
744
- ; CHECK-NEXT: [[NOTX:%.*]] = xor <2 x i32> [[X:%.*]], <i32 -1, i32 -1>
745
- ; CHECK-NEXT: [[A:%.*]] = add <2 x i32> [[Y:%.*]], [[X]]
746
- ; CHECK-NEXT: [[C:%.*]] = icmp ugt <2 x i32> [[NOTX]], [[Y]]
747
- ; CHECK-NEXT: [[R:%.*]] = select <2 x i1> [[C]], <2 x i32> [[A]], <2 x i32> <i32 -1, i32 -1>
748
- ; CHECK-NEXT: ret <2 x i32> [[R]]
742
+ ; CHECK-NEXT: [[A:%.*]] = add <2 x i32> [[Y:%.*]], [[X:%.*]]
743
+ ; CHECK-NEXT: [[TMP1:%.*]] = icmp ult <2 x i32> [[A]], [[Y]]
744
+ ; CHECK-NEXT: [[TMP2:%.*]] = select <2 x i1> [[TMP1]], <2 x i32> <i32 -1, i32 -1>, <2 x i32> [[A]]
745
+ ; CHECK-NEXT: ret <2 x i32> [[TMP2]]
749
746
;
750
747
%notx = xor <2 x i32 > %x , <i32 -1 , i32 -1 >
751
748
%a = add <2 x i32 > %y , %x
@@ -757,11 +754,10 @@ define <2 x i32> @uadd_sat_commute_select_ugt(<2 x i32> %x, <2 x i32> %y) {
757
754
define i32 @uadd_sat_commute_select_ugt_commute_add (i32 %xp , i32 %y ) {
758
755
; CHECK-LABEL: @uadd_sat_commute_select_ugt_commute_add(
759
756
; CHECK-NEXT: [[X:%.*]] = srem i32 42, [[XP:%.*]]
760
- ; CHECK-NEXT: [[NOTX:%.*]] = xor i32 [[X]], -1
761
757
; CHECK-NEXT: [[A:%.*]] = add i32 [[X]], [[Y:%.*]]
762
- ; CHECK-NEXT: [[C :%.*]] = icmp ugt i32 [[NOTX ]], [[Y]]
763
- ; CHECK-NEXT: [[R :%.*]] = select i1 [[C ]], i32 [[A]], i32 -1
764
- ; CHECK-NEXT: ret i32 [[R ]]
758
+ ; CHECK-NEXT: [[TMP1 :%.*]] = icmp ult i32 [[A ]], [[Y]]
759
+ ; CHECK-NEXT: [[TMP2 :%.*]] = select i1 [[TMP1 ]], i32 -1, i32 [[A]]
760
+ ; CHECK-NEXT: ret i32 [[TMP2 ]]
765
761
;
766
762
%x = srem i32 42 , %xp ; thwart complexity-based-canonicalization
767
763
%notx = xor i32 %x , -1
0 commit comments