Skip to content

Commit 75b2518

Browse files
committed
[InstCombine] add tests for non-splat select(ext)
llvm-svn: 282901
1 parent ed95a08 commit 75b2518

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

llvm/test/Transforms/InstCombine/select-bitext.ll

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,17 @@ define <2 x i32> @test_vectors_sext(<2 x i1> %cca, <2 x i1> %ccb) {
166166
ret <2 x i32> %r
167167
}
168168

169+
define <2 x i32> @test_vectors_sext_nonsplat(<2 x i1> %cca, <2 x i1> %ccb) {
170+
; CHECK-LABEL: @test_vectors_sext_nonsplat(
171+
; CHECK-NEXT: [[CCAX:%.*]] = sext <2 x i1> %cca to <2 x i32>
172+
; CHECK-NEXT: [[R:%.*]] = select <2 x i1> %ccb, <2 x i32> [[CCAX]], <2 x i32> <i32 0, i32 -1>
173+
; CHECK-NEXT: ret <2 x i32> [[R]]
174+
;
175+
%ccax = sext <2 x i1> %cca to <2 x i32>
176+
%r = select <2 x i1> %ccb, <2 x i32> %ccax, <2 x i32> <i32 0, i32 -1>
177+
ret <2 x i32> %r
178+
}
179+
169180
define <2 x i32> @test_vectors_zext(<2 x i1> %cca, <2 x i1> %ccb) {
170181
; CHECK-LABEL: @test_vectors_zext(
171182
; CHECK-NEXT: [[FOLD_R:%.*]] = and <2 x i1> %ccb, %cca
@@ -177,6 +188,17 @@ define <2 x i32> @test_vectors_zext(<2 x i1> %cca, <2 x i1> %ccb) {
177188
ret <2 x i32> %r
178189
}
179190

191+
define <2 x i32> @test_vectors_zext_nonsplat(<2 x i1> %cca, <2 x i1> %ccb) {
192+
; CHECK-LABEL: @test_vectors_zext_nonsplat(
193+
; CHECK-NEXT: [[CCAX:%.*]] = zext <2 x i1> %cca to <2 x i32>
194+
; CHECK-NEXT: [[R:%.*]] = select <2 x i1> %ccb, <2 x i32> [[CCAX]], <2 x i32> <i32 1, i32 0>
195+
; CHECK-NEXT: ret <2 x i32> [[R]]
196+
;
197+
%ccax = zext <2 x i1> %cca to <2 x i32>
198+
%r = select <2 x i1> %ccb, <2 x i32> %ccax, <2 x i32> <i32 1, i32 0>
199+
ret <2 x i32> %r
200+
}
201+
180202
define <2 x i32> @scalar_select_of_vectors_sext(<2 x i1> %cca, i1 %ccb) {
181203
; CHECK-LABEL: @scalar_select_of_vectors_sext(
182204
; CHECK-NEXT: [[FOLD_R:%.*]] = select i1 %ccb, <2 x i1> %cca, <2 x i1> zeroinitializer

0 commit comments

Comments
 (0)