@@ -960,9 +960,8 @@ define i8 @or_not_xor_common_op_use2(i8 %x, i8 %y, i8 %z) {
960
960
define i4 @or_nand_xor_common_op_commute0 (i4 %x , i4 %y , i4 %z ) {
961
961
; CHECK-LABEL: @or_nand_xor_common_op_commute0(
962
962
; CHECK-NEXT: [[AND:%.*]] = and i4 [[X:%.*]], [[Z:%.*]]
963
- ; CHECK-NEXT: [[NAND:%.*]] = xor i4 [[AND]], -1
964
- ; CHECK-NEXT: [[XOR:%.*]] = xor i4 [[X]], [[Y:%.*]]
965
- ; CHECK-NEXT: [[R:%.*]] = or i4 [[XOR]], [[NAND]]
963
+ ; CHECK-NEXT: [[TMP1:%.*]] = and i4 [[AND]], [[Y:%.*]]
964
+ ; CHECK-NEXT: [[R:%.*]] = xor i4 [[TMP1]], -1
966
965
; CHECK-NEXT: ret i4 [[R]]
967
966
;
968
967
%and = and i4 %x , %z
@@ -975,9 +974,8 @@ define i4 @or_nand_xor_common_op_commute0(i4 %x, i4 %y, i4 %z) {
975
974
define <2 x i4 > @or_nand_xor_common_op_commute1 (<2 x i4 > %x , <2 x i4 > %y , <2 x i4 > %z ) {
976
975
; CHECK-LABEL: @or_nand_xor_common_op_commute1(
977
976
; CHECK-NEXT: [[AND:%.*]] = and <2 x i4> [[Z:%.*]], [[X:%.*]]
978
- ; CHECK-NEXT: [[NAND:%.*]] = xor <2 x i4> [[AND]], <i4 poison, i4 -1>
979
- ; CHECK-NEXT: [[XOR:%.*]] = xor <2 x i4> [[X]], [[Y:%.*]]
980
- ; CHECK-NEXT: [[R:%.*]] = or <2 x i4> [[XOR]], [[NAND]]
977
+ ; CHECK-NEXT: [[TMP1:%.*]] = and <2 x i4> [[AND]], [[Y:%.*]]
978
+ ; CHECK-NEXT: [[R:%.*]] = xor <2 x i4> [[TMP1]], <i4 -1, i4 -1>
981
979
; CHECK-NEXT: ret <2 x i4> [[R]]
982
980
;
983
981
%and = and <2 x i4 > %z , %x
@@ -991,9 +989,8 @@ define i8 @or_nand_xor_common_op_commute2(i8 %x, i8 %y, i8 %z) {
991
989
; CHECK-LABEL: @or_nand_xor_common_op_commute2(
992
990
; CHECK-NEXT: [[AND:%.*]] = and i8 [[X:%.*]], [[Z:%.*]]
993
991
; CHECK-NEXT: call void @use(i8 [[AND]])
994
- ; CHECK-NEXT: [[NAND:%.*]] = xor i8 [[AND]], -1
995
- ; CHECK-NEXT: [[XOR:%.*]] = xor i8 [[Y:%.*]], [[X]]
996
- ; CHECK-NEXT: [[R:%.*]] = or i8 [[XOR]], [[NAND]]
992
+ ; CHECK-NEXT: [[TMP1:%.*]] = and i8 [[AND]], [[Y:%.*]]
993
+ ; CHECK-NEXT: [[R:%.*]] = xor i8 [[TMP1]], -1
997
994
; CHECK-NEXT: ret i8 [[R]]
998
995
;
999
996
%and = and i8 %x , %z
@@ -1009,8 +1006,8 @@ define i8 @or_nand_xor_common_op_commute3(i8 %x, i8 %y, i8 %z) {
1009
1006
; CHECK-NEXT: [[AND:%.*]] = and i8 [[Z:%.*]], [[X:%.*]]
1010
1007
; CHECK-NEXT: [[NAND:%.*]] = xor i8 [[AND]], -1
1011
1008
; CHECK-NEXT: call void @use(i8 [[NAND]])
1012
- ; CHECK-NEXT: [[XOR :%.*]] = xor i8 [[Y:%.* ]], [[X ]]
1013
- ; CHECK-NEXT: [[R:%.*]] = or i8 [[XOR ]], [[NAND]]
1009
+ ; CHECK-NEXT: [[TMP1 :%.*]] = and i8 [[AND ]], [[Y:%.* ]]
1010
+ ; CHECK-NEXT: [[R:%.*]] = xor i8 [[TMP1 ]], -1
1014
1011
; CHECK-NEXT: ret i8 [[R]]
1015
1012
;
1016
1013
%and = and i8 %z , %x
@@ -1024,10 +1021,10 @@ define i8 @or_nand_xor_common_op_commute3(i8 %x, i8 %y, i8 %z) {
1024
1021
define i8 @or_nand_xor_common_op_commute3_use2 (i8 %x , i8 %y , i8 %z ) {
1025
1022
; CHECK-LABEL: @or_nand_xor_common_op_commute3_use2(
1026
1023
; CHECK-NEXT: [[AND:%.*]] = and i8 [[Z:%.*]], [[X:%.*]]
1027
- ; CHECK-NEXT: [[NAND:%.*]] = xor i8 [[AND]], -1
1028
1024
; CHECK-NEXT: [[XOR:%.*]] = xor i8 [[Y:%.*]], [[X]]
1029
1025
; CHECK-NEXT: call void @use(i8 [[XOR]])
1030
- ; CHECK-NEXT: [[R:%.*]] = or i8 [[XOR]], [[NAND]]
1026
+ ; CHECK-NEXT: [[TMP1:%.*]] = and i8 [[AND]], [[Y]]
1027
+ ; CHECK-NEXT: [[R:%.*]] = xor i8 [[TMP1]], -1
1031
1028
; CHECK-NEXT: ret i8 [[R]]
1032
1029
;
1033
1030
%and = and i8 %z , %x
@@ -1038,6 +1035,8 @@ define i8 @or_nand_xor_common_op_commute3_use2(i8 %x, i8 %y, i8 %z) {
1038
1035
ret i8 %r
1039
1036
}
1040
1037
1038
+ ; negative test - too many extra uses
1039
+
1041
1040
define i8 @or_nand_xor_common_op_commute3_use3 (i8 %x , i8 %y , i8 %z ) {
1042
1041
; CHECK-LABEL: @or_nand_xor_common_op_commute3_use3(
1043
1042
; CHECK-NEXT: [[AND:%.*]] = and i8 [[Z:%.*]], [[X:%.*]]
0 commit comments