@@ -803,9 +803,9 @@ define i32 @uadd_sat_not(i32 %x, i32 %y) {
803
803
; CHECK-LABEL: @uadd_sat_not(
804
804
; CHECK-NEXT: [[NOTX:%.*]] = xor i32 [[X:%.*]], -1
805
805
; CHECK-NEXT: [[A:%.*]] = add i32 [[NOTX]], [[Y:%.*]]
806
- ; CHECK-NEXT: [[C :%.*]] = icmp ult i32 [[X ]], [[Y]]
807
- ; CHECK-NEXT: [[R :%.*]] = select i1 [[C ]], i32 -1, i32 [[A]]
808
- ; CHECK-NEXT: ret i32 [[R ]]
806
+ ; CHECK-NEXT: [[TMP1 :%.*]] = icmp ult i32 [[A ]], [[Y]]
807
+ ; CHECK-NEXT: [[TMP2 :%.*]] = select i1 [[TMP1 ]], i32 -1, i32 [[A]]
808
+ ; CHECK-NEXT: ret i32 [[TMP2 ]]
809
809
;
810
810
%notx = xor i32 %x , -1
811
811
%a = add i32 %notx , %y
@@ -820,9 +820,9 @@ define i32 @uadd_sat_not_commute_add(i32 %xp, i32 %yp) {
820
820
; CHECK-NEXT: [[Y:%.*]] = urem i32 42, [[YP:%.*]]
821
821
; CHECK-NEXT: [[NOTX:%.*]] = xor i32 [[X]], -1
822
822
; CHECK-NEXT: [[A:%.*]] = add nsw i32 [[Y]], [[NOTX]]
823
- ; CHECK-NEXT: [[C :%.*]] = icmp ult i32 [[X ]], [[Y]]
824
- ; CHECK-NEXT: [[R :%.*]] = select i1 [[C ]], i32 -1, i32 [[A]]
825
- ; CHECK-NEXT: ret i32 [[R ]]
823
+ ; CHECK-NEXT: [[TMP1 :%.*]] = icmp ult i32 [[A ]], [[Y]]
824
+ ; CHECK-NEXT: [[TMP2 :%.*]] = select i1 [[TMP1 ]], i32 -1, i32 [[A]]
825
+ ; CHECK-NEXT: ret i32 [[TMP2 ]]
826
826
;
827
827
%x = srem i32 42 , %xp ; thwart complexity-based-canonicalization
828
828
%y = urem i32 42 , %yp ; thwart complexity-based-canonicalization
@@ -837,9 +837,9 @@ define i32 @uadd_sat_not_ugt(i32 %x, i32 %y) {
837
837
; CHECK-LABEL: @uadd_sat_not_ugt(
838
838
; CHECK-NEXT: [[NOTX:%.*]] = xor i32 [[X:%.*]], -1
839
839
; CHECK-NEXT: [[A:%.*]] = add i32 [[NOTX]], [[Y:%.*]]
840
- ; CHECK-NEXT: [[C :%.*]] = icmp ugt i32 [[Y ]], [[X ]]
841
- ; CHECK-NEXT: [[R :%.*]] = select i1 [[C ]], i32 -1, i32 [[A]]
842
- ; CHECK-NEXT: ret i32 [[R ]]
840
+ ; CHECK-NEXT: [[TMP1 :%.*]] = icmp ult i32 [[A ]], [[Y ]]
841
+ ; CHECK-NEXT: [[TMP2 :%.*]] = select i1 [[TMP1 ]], i32 -1, i32 [[A]]
842
+ ; CHECK-NEXT: ret i32 [[TMP2 ]]
843
843
;
844
844
%notx = xor i32 %x , -1
845
845
%a = add i32 %notx , %y
@@ -853,9 +853,9 @@ define <2 x i32> @uadd_sat_not_ugt_commute_add(<2 x i32> %x, <2 x i32> %yp) {
853
853
; CHECK-NEXT: [[Y:%.*]] = sdiv <2 x i32> [[YP:%.*]], <i32 2442, i32 4242>
854
854
; CHECK-NEXT: [[NOTX:%.*]] = xor <2 x i32> [[X:%.*]], <i32 -1, i32 -1>
855
855
; CHECK-NEXT: [[A:%.*]] = add <2 x i32> [[Y]], [[NOTX]]
856
- ; CHECK-NEXT: [[C :%.*]] = icmp ugt <2 x i32> [[Y ]], [[X ]]
857
- ; CHECK-NEXT: [[R :%.*]] = select <2 x i1> [[C ]], <2 x i32> <i32 -1, i32 -1>, <2 x i32> [[A]]
858
- ; CHECK-NEXT: ret <2 x i32> [[R ]]
856
+ ; CHECK-NEXT: [[TMP1 :%.*]] = icmp ult <2 x i32> [[A ]], [[Y ]]
857
+ ; CHECK-NEXT: [[TMP2 :%.*]] = select <2 x i1> [[TMP1 ]], <2 x i32> <i32 -1, i32 -1>, <2 x i32> [[A]]
858
+ ; CHECK-NEXT: ret <2 x i32> [[TMP2 ]]
859
859
;
860
860
%y = sdiv <2 x i32 > %yp , <i32 2442 , i32 4242 > ; thwart complexity-based-canonicalization
861
861
%notx = xor <2 x i32 > %x , <i32 -1 , i32 -1 >
@@ -869,9 +869,9 @@ define i32 @uadd_sat_not_commute_select(i32 %x, i32 %y) {
869
869
; CHECK-LABEL: @uadd_sat_not_commute_select(
870
870
; CHECK-NEXT: [[NOTX:%.*]] = xor i32 [[X:%.*]], -1
871
871
; CHECK-NEXT: [[A:%.*]] = add i32 [[NOTX]], [[Y:%.*]]
872
- ; CHECK-NEXT: [[C :%.*]] = icmp ult i32 [[Y ]], [[X ]]
873
- ; CHECK-NEXT: [[R :%.*]] = select i1 [[C ]], i32 [[A]], i32 -1
874
- ; CHECK-NEXT: ret i32 [[R ]]
872
+ ; CHECK-NEXT: [[TMP1 :%.*]] = icmp ult i32 [[A ]], [[Y ]]
873
+ ; CHECK-NEXT: [[TMP2 :%.*]] = select i1 [[TMP1 ]], i32 -1, i32 [[A]]
874
+ ; CHECK-NEXT: ret i32 [[TMP2 ]]
875
875
;
876
876
%notx = xor i32 %x , -1
877
877
%a = add i32 %notx , %y
@@ -885,9 +885,9 @@ define i32 @uadd_sat_not_commute_select_commute_add(i32 %x, i32 %yp) {
885
885
; CHECK-NEXT: [[Y:%.*]] = sdiv i32 42, [[YP:%.*]]
886
886
; CHECK-NEXT: [[NOTX:%.*]] = xor i32 [[X:%.*]], -1
887
887
; CHECK-NEXT: [[A:%.*]] = add i32 [[Y]], [[NOTX]]
888
- ; CHECK-NEXT: [[C :%.*]] = icmp ult i32 [[Y ]], [[X ]]
889
- ; CHECK-NEXT: [[R :%.*]] = select i1 [[C ]], i32 [[A]], i32 -1
890
- ; CHECK-NEXT: ret i32 [[R ]]
888
+ ; CHECK-NEXT: [[TMP1 :%.*]] = icmp ult i32 [[A ]], [[Y ]]
889
+ ; CHECK-NEXT: [[TMP2 :%.*]] = select i1 [[TMP1 ]], i32 -1, i32 [[A]]
890
+ ; CHECK-NEXT: ret i32 [[TMP2 ]]
891
891
;
892
892
%y = sdiv i32 42 , %yp ; thwart complexity-based-canonicalization
893
893
%notx = xor i32 %x , -1
@@ -903,9 +903,9 @@ define <2 x i32> @uadd_sat_not_commute_select_ugt(<2 x i32> %xp, <2 x i32> %yp)
903
903
; CHECK-NEXT: [[Y:%.*]] = srem <2 x i32> <i32 12, i32 412>, [[YP:%.*]]
904
904
; CHECK-NEXT: [[NOTX:%.*]] = xor <2 x i32> [[X]], <i32 -1, i32 -1>
905
905
; CHECK-NEXT: [[A:%.*]] = add <2 x i32> [[Y]], [[NOTX]]
906
- ; CHECK-NEXT: [[C :%.*]] = icmp ugt <2 x i32> [[X ]], [[Y]]
907
- ; CHECK-NEXT: [[R :%.*]] = select <2 x i1> [[C ]], <2 x i32> [[A]], <2 x i32> <i32 -1, i32 -1>
908
- ; CHECK-NEXT: ret <2 x i32> [[R ]]
906
+ ; CHECK-NEXT: [[TMP1 :%.*]] = icmp ult <2 x i32> [[A ]], [[Y]]
907
+ ; CHECK-NEXT: [[TMP2 :%.*]] = select <2 x i1> [[TMP1 ]], <2 x i32> < i32 -1, i32 -1>, <2 x i32> [[A]]
908
+ ; CHECK-NEXT: ret <2 x i32> [[TMP2 ]]
909
909
;
910
910
%x = urem <2 x i32 > <i32 42 , i32 -42 >, %xp ; thwart complexity-based-canonicalization
911
911
%y = srem <2 x i32 > <i32 12 , i32 412 >, %yp ; thwart complexity-based-canonicalization
@@ -920,9 +920,9 @@ define i32 @uadd_sat_not_commute_select_ugt_commute_add(i32 %x, i32 %y) {
920
920
; CHECK-LABEL: @uadd_sat_not_commute_select_ugt_commute_add(
921
921
; CHECK-NEXT: [[NOTX:%.*]] = xor i32 [[X:%.*]], -1
922
922
; CHECK-NEXT: [[A:%.*]] = add i32 [[NOTX]], [[Y:%.*]]
923
- ; CHECK-NEXT: [[C :%.*]] = icmp ugt i32 [[X ]], [[Y]]
924
- ; CHECK-NEXT: [[R :%.*]] = select i1 [[C ]], i32 [[A]], i32 -1
925
- ; CHECK-NEXT: ret i32 [[R ]]
923
+ ; CHECK-NEXT: [[TMP1 :%.*]] = icmp ult i32 [[A ]], [[Y]]
924
+ ; CHECK-NEXT: [[TMP2 :%.*]] = select i1 [[TMP1 ]], i32 -1, i32 [[A]]
925
+ ; CHECK-NEXT: ret i32 [[TMP2 ]]
926
926
;
927
927
%notx = xor i32 %x , -1
928
928
%a = add i32 %notx , %y
0 commit comments