@@ -850,8 +850,7 @@ define void @common_binop_demand_via_splat_op0(<2 x i4> %x, <2 x i4> %y) {
850
850
; CHECK-LABEL: @common_binop_demand_via_splat_op0(
851
851
; CHECK-NEXT: [[XSHUF:%.*]] = shufflevector <2 x i4> [[X:%.*]], <2 x i4> poison, <2 x i32> zeroinitializer
852
852
; CHECK-NEXT: [[B_XSHUF_Y:%.*]] = mul <2 x i4> [[XSHUF]], [[Y:%.*]]
853
- ; CHECK-NEXT: [[B_XY:%.*]] = mul <2 x i4> [[X]], [[Y]]
854
- ; CHECK-NEXT: [[B_XY_SPLAT:%.*]] = shufflevector <2 x i4> [[B_XY]], <2 x i4> poison, <2 x i32> zeroinitializer
853
+ ; CHECK-NEXT: [[B_XY_SPLAT:%.*]] = shufflevector <2 x i4> [[B_XSHUF_Y]], <2 x i4> poison, <2 x i32> zeroinitializer
855
854
; CHECK-NEXT: call void @use(<2 x i4> [[B_XSHUF_Y]])
856
855
; CHECK-NEXT: call void @use(<2 x i4> [[B_XY_SPLAT]])
857
856
; CHECK-NEXT: ret void
@@ -870,8 +869,7 @@ define void @common_binop_demand_via_splat_op1(<2 x i4> %p, <2 x i4> %y) {
870
869
; CHECK-NEXT: [[X:%.*]] = sub <2 x i4> <i4 0, i4 1>, [[P:%.*]]
871
870
; CHECK-NEXT: [[YSHUF:%.*]] = shufflevector <2 x i4> [[Y:%.*]], <2 x i4> poison, <2 x i32> zeroinitializer
872
871
; CHECK-NEXT: [[B_X_YSHUF:%.*]] = mul <2 x i4> [[X]], [[YSHUF]]
873
- ; CHECK-NEXT: [[B_XY:%.*]] = mul <2 x i4> [[X]], [[Y]]
874
- ; CHECK-NEXT: [[B_XY_SPLAT:%.*]] = shufflevector <2 x i4> [[B_XY]], <2 x i4> poison, <2 x i32> zeroinitializer
872
+ ; CHECK-NEXT: [[B_XY_SPLAT:%.*]] = shufflevector <2 x i4> [[B_X_YSHUF]], <2 x i4> poison, <2 x i32> zeroinitializer
875
873
; CHECK-NEXT: call void @use(<2 x i4> [[B_XY_SPLAT]])
876
874
; CHECK-NEXT: call void @use(<2 x i4> [[B_X_YSHUF]])
877
875
; CHECK-NEXT: ret void
@@ -888,12 +886,11 @@ define void @common_binop_demand_via_splat_op1(<2 x i4> %p, <2 x i4> %y) {
888
886
889
887
define void @common_binop_demand_via_splat_op0_commute (<2 x i4 > %p , <2 x i4 > %q ) {
890
888
; CHECK-LABEL: @common_binop_demand_via_splat_op0_commute(
891
- ; CHECK-NEXT: [[X:%.*]] = sub <2 x i4> <i4 0, i4 1 >, [[P:%.*]]
889
+ ; CHECK-NEXT: [[X:%.*]] = sub <2 x i4> <i4 0, i4 poison >, [[P:%.*]]
892
890
; CHECK-NEXT: [[Y:%.*]] = sub <2 x i4> <i4 1, i4 2>, [[Q:%.*]]
893
891
; CHECK-NEXT: [[XSHUF:%.*]] = shufflevector <2 x i4> [[X]], <2 x i4> poison, <2 x i32> zeroinitializer
894
892
; CHECK-NEXT: [[B_Y_XSHUF:%.*]] = mul <2 x i4> [[Y]], [[XSHUF]]
895
- ; CHECK-NEXT: [[B_XY:%.*]] = mul <2 x i4> [[X]], [[Y]]
896
- ; CHECK-NEXT: [[B_XY_SPLAT:%.*]] = shufflevector <2 x i4> [[B_XY]], <2 x i4> poison, <2 x i32> zeroinitializer
893
+ ; CHECK-NEXT: [[B_XY_SPLAT:%.*]] = shufflevector <2 x i4> [[B_Y_XSHUF]], <2 x i4> poison, <2 x i32> zeroinitializer
897
894
; CHECK-NEXT: call void @use(<2 x i4> [[B_XY_SPLAT]])
898
895
; CHECK-NEXT: call void @use(<2 x i4> [[B_Y_XSHUF]])
899
896
; CHECK-NEXT: ret void
@@ -912,11 +909,10 @@ define void @common_binop_demand_via_splat_op0_commute(<2 x i4> %p, <2 x i4> %q)
912
909
define void @common_binop_demand_via_splat_op1_commute (<2 x i4 > %p , <2 x i4 > %q ) {
913
910
; CHECK-LABEL: @common_binop_demand_via_splat_op1_commute(
914
911
; CHECK-NEXT: [[X:%.*]] = sub <2 x i4> <i4 0, i4 1>, [[P:%.*]]
915
- ; CHECK-NEXT: [[Y:%.*]] = sub <2 x i4> <i4 2, i4 3 >, [[Q:%.*]]
912
+ ; CHECK-NEXT: [[Y:%.*]] = sub <2 x i4> <i4 2, i4 poison >, [[Q:%.*]]
916
913
; CHECK-NEXT: [[YSHUF:%.*]] = shufflevector <2 x i4> [[Y]], <2 x i4> poison, <2 x i32> zeroinitializer
917
914
; CHECK-NEXT: [[B_Y_XSHUF:%.*]] = mul <2 x i4> [[YSHUF]], [[X]]
918
- ; CHECK-NEXT: [[B_XY:%.*]] = mul <2 x i4> [[X]], [[Y]]
919
- ; CHECK-NEXT: [[B_XY_SPLAT:%.*]] = shufflevector <2 x i4> [[B_XY]], <2 x i4> poison, <2 x i32> zeroinitializer
915
+ ; CHECK-NEXT: [[B_XY_SPLAT:%.*]] = shufflevector <2 x i4> [[B_Y_XSHUF]], <2 x i4> poison, <2 x i32> zeroinitializer
920
916
; CHECK-NEXT: call void @use(<2 x i4> [[B_XY_SPLAT]])
921
917
; CHECK-NEXT: call void @use(<2 x i4> [[B_Y_XSHUF]])
922
918
; CHECK-NEXT: ret void
@@ -932,6 +928,8 @@ define void @common_binop_demand_via_splat_op1_commute(<2 x i4> %p, <2 x i4> %q)
932
928
ret void
933
929
}
934
930
931
+ ; negative test - wrong operands for sub
932
+
935
933
define void @common_binop_demand_via_splat_op0_wrong_commute (<2 x i4 > %x , <2 x i4 > %y ) {
936
934
; CHECK-LABEL: @common_binop_demand_via_splat_op0_wrong_commute(
937
935
; CHECK-NEXT: [[XSHUF:%.*]] = shufflevector <2 x i4> [[X:%.*]], <2 x i4> poison, <2 x i32> zeroinitializer
@@ -951,6 +949,8 @@ define void @common_binop_demand_via_splat_op0_wrong_commute(<2 x i4> %x, <2 x i
951
949
ret void
952
950
}
953
951
952
+ ; negative test - need to reorder insts?
953
+
954
954
define void @common_binop_demand_via_splat_op0_not_dominated1 (<2 x i4 > %x , <2 x i4 > %y ) {
955
955
; CHECK-LABEL: @common_binop_demand_via_splat_op0_not_dominated1(
956
956
; CHECK-NEXT: [[B_XY:%.*]] = mul <2 x i4> [[X:%.*]], [[Y:%.*]]
@@ -970,6 +970,8 @@ define void @common_binop_demand_via_splat_op0_not_dominated1(<2 x i4> %x, <2 x
970
970
ret void
971
971
}
972
972
973
+ ; negative test - need to reorder insts?
974
+
973
975
define void @common_binop_demand_via_splat_op0_not_dominated2 (<2 x i4 > %x , <2 x i4 > %y ) {
974
976
; CHECK-LABEL: @common_binop_demand_via_splat_op0_not_dominated2(
975
977
; CHECK-NEXT: [[B_XY:%.*]] = mul <2 x i4> [[X:%.*]], [[Y:%.*]]
@@ -993,8 +995,7 @@ define i4 @common_binop_demand_via_extelt_op0(<2 x i4> %x, <2 x i4> %y) {
993
995
; CHECK-LABEL: @common_binop_demand_via_extelt_op0(
994
996
; CHECK-NEXT: [[XSHUF:%.*]] = shufflevector <2 x i4> [[X:%.*]], <2 x i4> poison, <2 x i32> zeroinitializer
995
997
; CHECK-NEXT: [[B_XSHUF_Y:%.*]] = sub <2 x i4> [[XSHUF]], [[Y:%.*]]
996
- ; CHECK-NEXT: [[B_XY:%.*]] = sub nsw <2 x i4> [[X]], [[Y]]
997
- ; CHECK-NEXT: [[B_XY0:%.*]] = extractelement <2 x i4> [[B_XY]], i64 0
998
+ ; CHECK-NEXT: [[B_XY0:%.*]] = extractelement <2 x i4> [[B_XSHUF_Y]], i64 0
998
999
; CHECK-NEXT: call void @use(<2 x i4> [[B_XSHUF_Y]])
999
1000
; CHECK-NEXT: ret i4 [[B_XY0]]
1000
1001
;
@@ -1011,8 +1012,7 @@ define float @common_binop_demand_via_extelt_op1(<2 x float> %p, <2 x float> %y)
1011
1012
; CHECK-NEXT: [[X:%.*]] = fsub <2 x float> <float 0.000000e+00, float 1.000000e+00>, [[P:%.*]]
1012
1013
; CHECK-NEXT: [[YSHUF:%.*]] = shufflevector <2 x float> [[Y:%.*]], <2 x float> poison, <2 x i32> zeroinitializer
1013
1014
; CHECK-NEXT: [[B_X_YSHUF:%.*]] = fdiv <2 x float> [[X]], [[YSHUF]]
1014
- ; CHECK-NEXT: [[B_XY:%.*]] = fdiv <2 x float> [[X]], [[Y]]
1015
- ; CHECK-NEXT: [[B_XY0:%.*]] = extractelement <2 x float> [[B_XY]], i64 0
1015
+ ; CHECK-NEXT: [[B_XY0:%.*]] = extractelement <2 x float> [[B_X_YSHUF]], i64 0
1016
1016
; CHECK-NEXT: call void @use_fp(<2 x float> [[B_X_YSHUF]])
1017
1017
; CHECK-NEXT: ret float [[B_XY0]]
1018
1018
;
@@ -1027,12 +1027,11 @@ define float @common_binop_demand_via_extelt_op1(<2 x float> %p, <2 x float> %y)
1027
1027
1028
1028
define float @common_binop_demand_via_extelt_op0_commute (<2 x float > %p , <2 x float > %q ) {
1029
1029
; CHECK-LABEL: @common_binop_demand_via_extelt_op0_commute(
1030
- ; CHECK-NEXT: [[X:%.*]] = fsub <2 x float> <float 0.000000e+00, float 1.000000e+00 >, [[P:%.*]]
1030
+ ; CHECK-NEXT: [[X:%.*]] = fsub <2 x float> <float 0.000000e+00, float poison >, [[P:%.*]]
1031
1031
; CHECK-NEXT: [[Y:%.*]] = fsub <2 x float> <float 3.000000e+00, float 2.000000e+00>, [[Q:%.*]]
1032
1032
; CHECK-NEXT: [[XSHUF:%.*]] = shufflevector <2 x float> [[X]], <2 x float> poison, <2 x i32> zeroinitializer
1033
1033
; CHECK-NEXT: [[B_Y_XSHUF:%.*]] = fmul nnan <2 x float> [[Y]], [[XSHUF]]
1034
- ; CHECK-NEXT: [[B_XY:%.*]] = fmul ninf <2 x float> [[X]], [[Y]]
1035
- ; CHECK-NEXT: [[B_XY0:%.*]] = extractelement <2 x float> [[B_XY]], i64 0
1034
+ ; CHECK-NEXT: [[B_XY0:%.*]] = extractelement <2 x float> [[B_Y_XSHUF]], i64 0
1036
1035
; CHECK-NEXT: call void @use_fp(<2 x float> [[B_Y_XSHUF]])
1037
1036
; CHECK-NEXT: ret float [[B_XY0]]
1038
1037
;
@@ -1049,11 +1048,10 @@ define float @common_binop_demand_via_extelt_op0_commute(<2 x float> %p, <2 x fl
1049
1048
define i4 @common_binop_demand_via_extelt_op1_commute (<2 x i4 > %p , <2 x i4 > %q ) {
1050
1049
; CHECK-LABEL: @common_binop_demand_via_extelt_op1_commute(
1051
1050
; CHECK-NEXT: [[X:%.*]] = sub <2 x i4> <i4 0, i4 1>, [[P:%.*]]
1052
- ; CHECK-NEXT: [[Y:%.*]] = sub <2 x i4> <i4 2, i4 3 >, [[Q:%.*]]
1051
+ ; CHECK-NEXT: [[Y:%.*]] = sub <2 x i4> <i4 2, i4 poison >, [[Q:%.*]]
1053
1052
; CHECK-NEXT: [[YSHUF:%.*]] = shufflevector <2 x i4> [[Y]], <2 x i4> poison, <2 x i32> zeroinitializer
1054
1053
; CHECK-NEXT: [[B_Y_XSHUF:%.*]] = or <2 x i4> [[YSHUF]], [[X]]
1055
- ; CHECK-NEXT: [[B_XY:%.*]] = or <2 x i4> [[X]], [[Y]]
1056
- ; CHECK-NEXT: [[B_XY0:%.*]] = extractelement <2 x i4> [[B_XY]], i64 0
1054
+ ; CHECK-NEXT: [[B_XY0:%.*]] = extractelement <2 x i4> [[B_Y_XSHUF]], i64 0
1057
1055
; CHECK-NEXT: call void @use(<2 x i4> [[B_Y_XSHUF]])
1058
1056
; CHECK-NEXT: ret i4 [[B_XY0]]
1059
1057
;
@@ -1067,6 +1065,8 @@ define i4 @common_binop_demand_via_extelt_op1_commute(<2 x i4> %p, <2 x i4> %q)
1067
1065
ret i4 %b_xy0
1068
1066
}
1069
1067
1068
+ ; negative test - wrong operands for sub
1069
+
1070
1070
define i4 @common_binop_demand_via_extelt_op0_wrong_commute (<2 x i4 > %x , <2 x i4 > %y ) {
1071
1071
; CHECK-LABEL: @common_binop_demand_via_extelt_op0_wrong_commute(
1072
1072
; CHECK-NEXT: [[XSHUF:%.*]] = shufflevector <2 x i4> [[X:%.*]], <2 x i4> poison, <2 x i32> zeroinitializer
@@ -1084,6 +1084,8 @@ define i4 @common_binop_demand_via_extelt_op0_wrong_commute(<2 x i4> %x, <2 x i4
1084
1084
ret i4 %b_xy0
1085
1085
}
1086
1086
1087
+ ; negative test - need to reorder insts?
1088
+
1087
1089
define i4 @common_binop_demand_via_extelt_op0_not_dominated1 (<2 x i4 > %x , <2 x i4 > %y ) {
1088
1090
; CHECK-LABEL: @common_binop_demand_via_extelt_op0_not_dominated1(
1089
1091
; CHECK-NEXT: [[B_XY:%.*]] = xor <2 x i4> [[X:%.*]], [[Y:%.*]]
@@ -1101,6 +1103,8 @@ define i4 @common_binop_demand_via_extelt_op0_not_dominated1(<2 x i4> %x, <2 x i
1101
1103
ret i4 %b_xy0
1102
1104
}
1103
1105
1106
+ ; negative test - need to reorder insts?
1107
+
1104
1108
define i4 @common_binop_demand_via_extelt_op0_not_dominated2 (<2 x i4 > %x , <2 x i4 > %y ) {
1105
1109
; CHECK-LABEL: @common_binop_demand_via_extelt_op0_not_dominated2(
1106
1110
; CHECK-NEXT: [[B_XY:%.*]] = mul <2 x i4> [[X:%.*]], [[Y:%.*]]
@@ -1118,6 +1122,8 @@ define i4 @common_binop_demand_via_extelt_op0_not_dominated2(<2 x i4> %x, <2 x i
1118
1122
ret i4 %b_xy0
1119
1123
}
1120
1124
1125
+ ; negative test - splat doesn't match demanded element
1126
+
1121
1127
define i4 @common_binop_demand_via_extelt_op0_mismatch_elt0 (<2 x i4 > %x , <2 x i4 > %y ) {
1122
1128
; CHECK-LABEL: @common_binop_demand_via_extelt_op0_mismatch_elt0(
1123
1129
; CHECK-NEXT: [[XSHUF:%.*]] = shufflevector <2 x i4> [[X:%.*]], <2 x i4> poison, <2 x i32> <i32 1, i32 1>
@@ -1135,6 +1141,8 @@ define i4 @common_binop_demand_via_extelt_op0_mismatch_elt0(<2 x i4> %x, <2 x i4
1135
1141
ret i4 %b_xy0
1136
1142
}
1137
1143
1144
+ ; negative test - splat doesn't match demanded element
1145
+
1138
1146
define i4 @common_binop_demand_via_extelt_op0_mismatch_elt1 (<2 x i4 > %x , <2 x i4 > %y ) {
1139
1147
; CHECK-LABEL: @common_binop_demand_via_extelt_op0_mismatch_elt1(
1140
1148
; CHECK-NEXT: [[XSHUF:%.*]] = shufflevector <2 x i4> [[X:%.*]], <2 x i4> poison, <2 x i32> zeroinitializer
0 commit comments