Skip to content

Commit 28d85e2

Browse files
committed
[InstCombine] Add test for #89500 (NFC)
1 parent ff153bd commit 28d85e2

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

llvm/test/Transforms/InstCombine/select.ll

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2926,8 +2926,8 @@ define i8 @select_replacement_loop3(i32 noundef %x) {
29262926
define i16 @select_replacement_loop4(i16 noundef %p_12) {
29272927
; CHECK-LABEL: @select_replacement_loop4(
29282928
; CHECK-NEXT: [[AND1:%.*]] = and i16 [[P_12:%.*]], 1
2929-
; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i16 [[P_12]], 2
2930-
; CHECK-NEXT: [[AND3:%.*]] = select i1 [[CMP2]], i16 [[AND1]], i16 0
2929+
; CHECK-NEXT: [[CMP21:%.*]] = icmp ult i16 [[P_12]], 2
2930+
; CHECK-NEXT: [[AND3:%.*]] = select i1 [[CMP21]], i16 [[AND1]], i16 0
29312931
; CHECK-NEXT: ret i16 [[AND3]]
29322932
;
29332933
%cmp1 = icmp ult i16 %p_12, 2
@@ -3113,8 +3113,8 @@ define <4 x i32> @mul_select_eq_zero_vector(<4 x i32> %x, <4 x i32> %y) {
31133113
; select (<k x elt> x == {0, poison, ...}), <k x elt> 0, <k x elt> x * y --> freeze(y) * x
31143114
define <2 x i32> @mul_select_eq_poison_vector(<2 x i32> %x, <2 x i32> %y) {
31153115
; CHECK-LABEL: @mul_select_eq_poison_vector(
3116-
; CHECK-NEXT: [[C:%.*]] = icmp eq <2 x i32> [[Y_FR:%.*]], <i32 0, i32 poison>
3117-
; CHECK-NEXT: [[M:%.*]] = mul <2 x i32> [[Y_FR]], [[X:%.*]]
3116+
; CHECK-NEXT: [[C:%.*]] = icmp eq <2 x i32> [[X:%.*]], <i32 0, i32 poison>
3117+
; CHECK-NEXT: [[M:%.*]] = mul <2 x i32> [[X]], [[Y:%.*]]
31183118
; CHECK-NEXT: [[R:%.*]] = select <2 x i1> [[C]], <2 x i32> <i32 0, i32 42>, <2 x i32> [[M]]
31193119
; CHECK-NEXT: ret <2 x i32> [[R]]
31203120
;
@@ -3830,6 +3830,26 @@ entry:
38303830
ret i32 %cond
38313831
}
38323832

3833+
; FIXME: This is a miscompile.
3834+
define <2 x i32> @src_and_eq_C_xor_OrAndNotC_vec_poison(<2 x i32> %0, <2 x i32> %1, <2 x i32> %2) {
3835+
; CHECK-LABEL: @src_and_eq_C_xor_OrAndNotC_vec_poison(
3836+
; CHECK-NEXT: entry:
3837+
; CHECK-NEXT: [[OR:%.*]] = or <2 x i32> [[TMP1:%.*]], [[TMP0:%.*]]
3838+
; CHECK-NEXT: [[NOT:%.*]] = xor <2 x i32> [[TMP2:%.*]], <i32 -1, i32 poison>
3839+
; CHECK-NEXT: [[AND1:%.*]] = and <2 x i32> [[OR]], [[NOT]]
3840+
; CHECK-NEXT: ret <2 x i32> [[AND1]]
3841+
;
3842+
entry:
3843+
%and = and <2 x i32> %1, %0
3844+
%cmp = icmp eq <2 x i32> %and, %2
3845+
%xor = xor <2 x i32> %1, %0
3846+
%or = or <2 x i32> %1, %0
3847+
%not = xor <2 x i32> %2, <i32 -1, i32 poison>
3848+
%and1 = and <2 x i32> %or, %not
3849+
%cond = select <2 x i1> %cmp, <2 x i32> %xor, <2 x i32> %and1
3850+
ret <2 x i32> %cond
3851+
}
3852+
38333853
define i32 @src_and_eq_C_xor_orxorC(i32 %x, i32 %y, i32 %c) {
38343854
; CHECK-LABEL: @src_and_eq_C_xor_orxorC(
38353855
; CHECK-NEXT: entry:

0 commit comments

Comments
 (0)