@@ -557,7 +557,7 @@ define <4 x i32> @mul_const_splat(<4 x i32> %v) {
557
557
558
558
define <4 x i32 > @lshr_const_half_splat (<4 x i32 > %v ) {
559
559
; CHECK-LABEL: @lshr_const_half_splat(
560
- ; CHECK-NEXT: [[TMP1:%.*]] = lshr <4 x i32> <i32 undef , i32 8, i32 9, i32 undef >, [[V:%.*]]
560
+ ; CHECK-NEXT: [[TMP1:%.*]] = lshr <4 x i32> <i32 poison , i32 8, i32 9, i32 poison >, [[V:%.*]]
561
561
; CHECK-NEXT: [[R:%.*]] = shufflevector <4 x i32> [[TMP1]], <4 x i32> poison, <4 x i32> <i32 1, i32 1, i32 2, i32 2>
562
562
; CHECK-NEXT: ret <4 x i32> [[R]]
563
563
;
@@ -659,27 +659,23 @@ define <4 x i16> @widening_shuffle_shl_constant_op1(<2 x i16> %v) {
659
659
ret <4 x i16 > %bo
660
660
}
661
661
662
- ; A binop that does not produce undef in the high lanes can not be moved before the shuffle.
663
- ; This is not ok because 'shl undef, 1 (or 2)' --> 0' but moving the shuffle results in undef instead.
662
+ ; This is valid for poison, but would not be valid for undef.
664
663
665
664
define <4 x i16 > @widening_shuffle_shl_constant_op1_non0 (<2 x i16 > %v ) {
666
665
; CHECK-LABEL: @widening_shuffle_shl_constant_op1_non0(
667
- ; CHECK-NEXT: [[SHUF :%.*]] = shufflevector <2 x i16> [[V:%.*]], <2 x i16> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison >
668
- ; CHECK-NEXT: [[BO:%.*]] = shl <4 x i16> [[SHUF ]], <i16 2, i16 4, i16 1, i16 2 >
666
+ ; CHECK-NEXT: [[TMP1 :%.*]] = shl <2 x i16> [[V:%.*]], <i16 2, i16 4 >
667
+ ; CHECK-NEXT: [[BO:%.*]] = shufflevector <2 x i16> [[TMP1 ]], <2 x i16> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison >
669
668
; CHECK-NEXT: ret <4 x i16> [[BO]]
670
669
;
671
670
%shuf = shufflevector <2 x i16 > %v , <2 x i16 > poison, <4 x i32 > <i32 0 , i32 1 , i32 undef , i32 undef >
672
671
%bo = shl <4 x i16 > %shuf , <i16 2 , i16 4 , i16 1 , i16 2 >
673
672
ret <4 x i16 > %bo
674
673
}
675
674
676
- ; A binop that does not produce undef in the high lanes can not be moved before the shuffle.
677
- ; This is not ok because 'or -1, undef --> -1' but moving the shuffle results in undef instead.
678
-
679
675
define <4 x i16 > @widening_shuffle_or (<2 x i16 > %v ) {
680
676
; CHECK-LABEL: @widening_shuffle_or(
681
- ; CHECK-NEXT: [[SHUF :%.*]] = shufflevector <2 x i16> [[V:%.*]], <2 x i16> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison >
682
- ; CHECK-NEXT: [[BO:%.*]] = or <4 x i16> [[SHUF ]], <i16 42, i16 -42, i16 - 1, i16 -1 >
677
+ ; CHECK-NEXT: [[TMP1 :%.*]] = or <2 x i16> [[V:%.*]], <i16 42, i16 -42 >
678
+ ; CHECK-NEXT: [[BO:%.*]] = shufflevector <2 x i16> [[TMP1 ]], <2 x i16> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison >
683
679
; CHECK-NEXT: ret <4 x i16> [[BO]]
684
680
;
685
681
%shuf = shufflevector <2 x i16 > %v , <2 x i16 > poison, <4 x i32 > <i32 0 , i32 1 , i32 undef , i32 undef >
@@ -856,7 +852,7 @@ define <2 x i32> @mul_splat_constant(<2 x i32> %x) {
856
852
857
853
define <2 x i32 > @shl_splat_constant0 (<2 x i32 > %x ) {
858
854
; CHECK-LABEL: @shl_splat_constant0(
859
- ; CHECK-NEXT: [[TMP1:%.*]] = shl <2 x i32> <i32 5, i32 undef >, [[X:%.*]]
855
+ ; CHECK-NEXT: [[TMP1:%.*]] = shl <2 x i32> <i32 5, i32 poison >, [[X:%.*]]
860
856
; CHECK-NEXT: [[R:%.*]] = shufflevector <2 x i32> [[TMP1]], <2 x i32> poison, <2 x i32> zeroinitializer
861
857
; CHECK-NEXT: ret <2 x i32> [[R]]
862
858
;
@@ -878,7 +874,7 @@ define <2 x i32> @shl_splat_constant1(<2 x i32> %x) {
878
874
879
875
define <2 x i32 > @ashr_splat_constant0 (<2 x i32 > %x ) {
880
876
; CHECK-LABEL: @ashr_splat_constant0(
881
- ; CHECK-NEXT: [[TMP1:%.*]] = ashr <2 x i32> <i32 5, i32 undef >, [[X:%.*]]
877
+ ; CHECK-NEXT: [[TMP1:%.*]] = lshr <2 x i32> <i32 5, i32 poison >, [[X:%.*]]
882
878
; CHECK-NEXT: [[R:%.*]] = shufflevector <2 x i32> [[TMP1]], <2 x i32> poison, <2 x i32> zeroinitializer
883
879
; CHECK-NEXT: ret <2 x i32> [[R]]
884
880
;
@@ -900,7 +896,7 @@ define <2 x i32> @ashr_splat_constant1(<2 x i32> %x) {
900
896
901
897
define <2 x i32 > @lshr_splat_constant0 (<2 x i32 > %x ) {
902
898
; CHECK-LABEL: @lshr_splat_constant0(
903
- ; CHECK-NEXT: [[TMP1:%.*]] = lshr <2 x i32> <i32 5, i32 undef >, [[X:%.*]]
899
+ ; CHECK-NEXT: [[TMP1:%.*]] = lshr <2 x i32> <i32 5, i32 poison >, [[X:%.*]]
904
900
; CHECK-NEXT: [[R:%.*]] = shufflevector <2 x i32> [[TMP1]], <2 x i32> poison, <2 x i32> zeroinitializer
905
901
; CHECK-NEXT: ret <2 x i32> [[R]]
906
902
;
@@ -1019,13 +1015,10 @@ define <2 x i32> @and_splat_constant(<2 x i32> %x) {
1019
1015
ret <2 x i32 > %r
1020
1016
}
1021
1017
1022
- ; AND does not fold to undef for undef operands, we cannot move it
1023
- ; across a shuffle with undef masks.
1024
- define <4 x i16 > @and_constant_mask_undef (<4 x i16 > %add ) {
1025
- ; CHECK-LABEL: @and_constant_mask_undef(
1018
+ define <4 x i16 > @and_constant_mask_poison (<4 x i16 > %add ) {
1019
+ ; CHECK-LABEL: @and_constant_mask_poison(
1026
1020
; CHECK-NEXT: entry:
1027
- ; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <4 x i16> [[ADD:%.*]], <4 x i16> poison, <4 x i32> <i32 poison, i32 poison, i32 1, i32 1>
1028
- ; CHECK-NEXT: [[AND:%.*]] = and <4 x i16> [[SHUFFLE]], <i16 0, i16 0, i16 -1, i16 -1>
1021
+ ; CHECK-NEXT: [[AND:%.*]] = shufflevector <4 x i16> [[ADD:%.*]], <4 x i16> poison, <4 x i32> <i32 poison, i32 poison, i32 1, i32 1>
1029
1022
; CHECK-NEXT: ret <4 x i16> [[AND]]
1030
1023
;
1031
1024
entry:
@@ -1034,13 +1027,10 @@ entry:
1034
1027
ret <4 x i16 > %and
1035
1028
}
1036
1029
1037
- ; AND does not fold to undef for undef operands, we cannot move it
1038
- ; across a shuffle with undef masks.
1039
- define <4 x i16 > @and_constant_mask_undef_2 (<4 x i16 > %add ) {
1040
- ; CHECK-LABEL: @and_constant_mask_undef_2(
1030
+ define <4 x i16 > @and_constant_mask_poison_2 (<4 x i16 > %add ) {
1031
+ ; CHECK-LABEL: @and_constant_mask_poison_2(
1041
1032
; CHECK-NEXT: entry:
1042
- ; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <4 x i16> [[ADD:%.*]], <4 x i16> poison, <4 x i32> <i32 1, i32 1, i32 1, i32 poison>
1043
- ; CHECK-NEXT: [[AND:%.*]] = and <4 x i16> [[SHUFFLE]], <i16 -1, i16 -1, i16 -1, i16 0>
1033
+ ; CHECK-NEXT: [[AND:%.*]] = shufflevector <4 x i16> [[ADD:%.*]], <4 x i16> poison, <4 x i32> <i32 1, i32 1, i32 1, i32 poison>
1044
1034
; CHECK-NEXT: ret <4 x i16> [[AND]]
1045
1035
;
1046
1036
entry:
@@ -1050,8 +1040,8 @@ entry:
1050
1040
}
1051
1041
1052
1042
; We can move the AND across the shuffle, as -1 (AND identity value) is used for undef lanes.
1053
- define <4 x i16 > @and_constant_mask_undef_3 (<4 x i16 > %add ) {
1054
- ; CHECK-LABEL: @and_constant_mask_undef_3 (
1043
+ define <4 x i16 > @and_constant_mask_poison_3 (<4 x i16 > %add ) {
1044
+ ; CHECK-LABEL: @and_constant_mask_poison_3 (
1055
1045
; CHECK-NEXT: entry:
1056
1046
; CHECK-NEXT: ret <4 x i16> <i16 0, i16 0, i16 0, i16 undef>
1057
1047
;
@@ -1062,8 +1052,8 @@ entry:
1062
1052
}
1063
1053
1064
1054
; We can move the AND across the shuffle, as -1 (AND identity value) is used for undef lanes.
1065
- define <4 x i16 > @and_constant_mask_undef_4 (<4 x i16 > %add ) {
1066
- ; CHECK-LABEL: @and_constant_mask_undef_4 (
1055
+ define <4 x i16 > @and_constant_mask_poison_4 (<4 x i16 > %add ) {
1056
+ ; CHECK-LABEL: @and_constant_mask_poison_4 (
1067
1057
; CHECK-NEXT: entry:
1068
1058
; CHECK-NEXT: [[TMP0:%.*]] = and <4 x i16> [[ADD:%.*]], <i16 9, i16 20, i16 poison, i16 poison>
1069
1059
; CHECK-NEXT: [[AND:%.*]] = shufflevector <4 x i16> [[TMP0]], <4 x i16> poison, <4 x i32> <i32 0, i32 1, i32 1, i32 poison>
@@ -1088,13 +1078,10 @@ entry:
1088
1078
ret <4 x i16 > %and
1089
1079
}
1090
1080
1091
- ; OR does not fold to undef for undef operands, we cannot move it
1092
- ; across a shuffle with undef masks.
1093
- define <4 x i16 > @or_constant_mask_undef (<4 x i16 > %in ) {
1094
- ; CHECK-LABEL: @or_constant_mask_undef(
1081
+ define <4 x i16 > @or_constant_mask_poison (<4 x i16 > %in ) {
1082
+ ; CHECK-LABEL: @or_constant_mask_poison(
1095
1083
; CHECK-NEXT: entry:
1096
- ; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <4 x i16> [[IN:%.*]], <4 x i16> poison, <4 x i32> <i32 poison, i32 poison, i32 1, i32 1>
1097
- ; CHECK-NEXT: [[OR:%.*]] = or <4 x i16> [[SHUFFLE]], <i16 -1, i16 -1, i16 0, i16 0>
1084
+ ; CHECK-NEXT: [[OR:%.*]] = shufflevector <4 x i16> [[IN:%.*]], <4 x i16> poison, <4 x i32> <i32 poison, i32 poison, i32 1, i32 1>
1098
1085
; CHECK-NEXT: ret <4 x i16> [[OR]]
1099
1086
;
1100
1087
entry:
@@ -1103,13 +1090,10 @@ entry:
1103
1090
ret <4 x i16 > %or
1104
1091
}
1105
1092
1106
- ; OR does not fold to undef for undef operands, we cannot move it
1107
- ; across a shuffle with undef masks.
1108
- define <4 x i16 > @or_constant_mask_undef_2 (<4 x i16 > %in ) {
1109
- ; CHECK-LABEL: @or_constant_mask_undef_2(
1093
+ define <4 x i16 > @or_constant_mask_poison_2 (<4 x i16 > %in ) {
1094
+ ; CHECK-LABEL: @or_constant_mask_poison_2(
1110
1095
; CHECK-NEXT: entry:
1111
- ; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <4 x i16> [[IN:%.*]], <4 x i16> poison, <4 x i32> <i32 poison, i32 1, i32 1, i32 poison>
1112
- ; CHECK-NEXT: [[OR:%.*]] = or <4 x i16> [[SHUFFLE]], <i16 -1, i16 0, i16 0, i16 -1>
1096
+ ; CHECK-NEXT: [[OR:%.*]] = shufflevector <4 x i16> [[IN:%.*]], <4 x i16> poison, <4 x i32> <i32 poison, i32 1, i32 1, i32 poison>
1113
1097
; CHECK-NEXT: ret <4 x i16> [[OR]]
1114
1098
;
1115
1099
entry:
@@ -1119,8 +1103,8 @@ entry:
1119
1103
}
1120
1104
1121
1105
; We can move the OR across the shuffle, as 0 (OR identity value) is used for undef lanes.
1122
- define <4 x i16 > @or_constant_mask_undef_3 (<4 x i16 > %in ) {
1123
- ; CHECK-LABEL: @or_constant_mask_undef_3 (
1106
+ define <4 x i16 > @or_constant_mask_poison_3 (<4 x i16 > %in ) {
1107
+ ; CHECK-LABEL: @or_constant_mask_poison_3 (
1124
1108
; CHECK-NEXT: entry:
1125
1109
; CHECK-NEXT: ret <4 x i16> <i16 undef, i16 -1, i16 -1, i16 undef>
1126
1110
;
@@ -1131,8 +1115,8 @@ entry:
1131
1115
}
1132
1116
1133
1117
; We can move the OR across the shuffle, as 0 (OR identity value) is used for undef lanes.
1134
- define <4 x i16 > @or_constant_mask_undef_4 (<4 x i16 > %in ) {
1135
- ; CHECK-LABEL: @or_constant_mask_undef_4 (
1118
+ define <4 x i16 > @or_constant_mask_poison_4 (<4 x i16 > %in ) {
1119
+ ; CHECK-LABEL: @or_constant_mask_poison_4 (
1136
1120
; CHECK-NEXT: entry:
1137
1121
; CHECK-NEXT: [[TMP0:%.*]] = or <4 x i16> [[IN:%.*]], <i16 poison, i16 99, i16 poison, i16 poison>
1138
1122
; CHECK-NEXT: [[OR:%.*]] = shufflevector <4 x i16> [[TMP0]], <4 x i16> poison, <4 x i32> <i32 poison, i32 1, i32 1, i32 poison>
@@ -1160,8 +1144,8 @@ entry:
1160
1144
define <4 x i16 > @shl_constant_mask_undef (<4 x i16 > %in ) {
1161
1145
; CHECK-LABEL: @shl_constant_mask_undef(
1162
1146
; CHECK-NEXT: entry:
1163
- ; CHECK-NEXT: [[SHUFFLE :%.*]] = shufflevector <4 x i16> [[IN:%.*]], <4 x i16> poison, <4 x i32> <i32 0, i32 poison, i32 1, i32 1 >
1164
- ; CHECK-NEXT: [[SHL:%.*]] = shl <4 x i16> [[SHUFFLE ]], <i16 10, i16 3, i16 0, i16 0 >
1147
+ ; CHECK-NEXT: [[TMP0 :%.*]] = shl <4 x i16> [[IN:%.*]], <i16 10, i16 0, i16 0, i16 0 >
1148
+ ; CHECK-NEXT: [[SHL:%.*]] = shufflevector <4 x i16> [[TMP0 ]], <4 x i16> poison, <4 x i32> <i32 0, i32 poison, i32 1, i32 1 >
1165
1149
; CHECK-NEXT: ret <4 x i16> [[SHL]]
1166
1150
;
1167
1151
entry:
0 commit comments