Skip to content

Commit 2f6d821

Browse files
committed
Extend the test coverage in combine-vec-shuffle-2.ll adding some negative tests.
Add test cases where we don't expect to trigger the combine optimizations introduced at revision 212748. No functional change intended. llvm-svn: 212756
1 parent 0fcf3cc commit 2f6d821

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

llvm/test/CodeGen/X86/combine-vec-shuffle-2.ll

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,92 @@ define <4 x i32> @test14(<4 x i32> %A, <4 x i32> %B) {
162162
; CHECK-NOT: pshufd
163163
; CHECK: ret
164164

165+
166+
; Verify that we don't optimize the following cases. We expect more than one shuffle.
167+
168+
define <4 x i32> @test15(<4 x i32> %A, <4 x i32> %B) {
169+
%1 = shufflevector <4 x i32> %A, <4 x i32> %B, <4 x i32> <i32 0, i32 4, i32 3, i32 1>
170+
%2 = shufflevector <4 x i32> %1, <4 x i32> undef, <4 x i32> <i32 2, i32 1, i32 0, i32 3>
171+
ret <4 x i32> %2
172+
}
173+
; CHECK-LABEL: test15
174+
; CHECK: shufps $114
175+
; CHECK-NEXT: pshufd $-58
176+
; CHECK-NEXT: ret
177+
178+
179+
define <4 x i32> @test16(<4 x i32> %A, <4 x i32> %B) {
180+
%1 = shufflevector <4 x i32> %A, <4 x i32> %B, <4 x i32> <i32 0, i32 5, i32 2, i32 7>
181+
%2 = shufflevector <4 x i32> %1, <4 x i32> undef, <4 x i32> <i32 2, i32 1, i32 0, i32 3>
182+
ret <4 x i32> %2
183+
}
184+
; CHECK-LABEL: test16
185+
; CHECK: blendps $10
186+
; CHECK-NEXT: pshufd $-58
187+
; CHECK-NEXT: ret
188+
189+
190+
define <4 x i32> @test17(<4 x i32> %A, <4 x i32> %B) {
191+
%1 = shufflevector <4 x i32> %A, <4 x i32> %B, <4 x i32> <i32 4, i32 1, i32 3, i32 1>
192+
%2 = shufflevector <4 x i32> %1, <4 x i32> undef, <4 x i32> <i32 2, i32 1, i32 0, i32 3>
193+
ret <4 x i32> %2
194+
}
195+
; CHECK-LABEL: test17
196+
; CHECK: shufps $120
197+
; CHECK-NEXT: pshufd $-58
198+
; CHECK-NEXT: ret
199+
200+
201+
define <4 x i32> @test18(<4 x i32> %A, <4 x i32> %B) {
202+
%1 = shufflevector <4 x i32> %A, <4 x i32> %B, <4 x i32> <i32 4, i32 5, i32 2, i32 7>
203+
%2 = shufflevector <4 x i32> %1, <4 x i32> undef, <4 x i32> <i32 1, i32 1, i32 0, i32 3>
204+
ret <4 x i32> %2
205+
}
206+
; CHECK-LABEL: test18
207+
; CHECK: blendps $11
208+
; CHECK-NEXT: pshufd $-59
209+
; CHECK-NEXT: ret
210+
211+
define <4 x i32> @test19(<4 x i32> %A, <4 x i32> %B) {
212+
%1 = shufflevector <4 x i32> %A, <4 x i32> %B, <4 x i32> <i32 0, i32 4, i32 5, i32 6>
213+
%2 = shufflevector <4 x i32> %1, <4 x i32> undef, <4 x i32> <i32 2, i32 0, i32 0, i32 0>
214+
ret <4 x i32> %2
215+
}
216+
; CHECK-LABEL: test19
217+
; CHECK: shufps $-104
218+
; CHECK-NEXT: pshufd $2
219+
; CHECK-NEXT: ret
220+
221+
222+
define <4 x i32> @test20(<4 x i32> %A, <4 x i32> %B) {
223+
%1 = shufflevector <4 x i32> %A, <4 x i32> %B, <4 x i32> <i32 3, i32 2, i32 4, i32 4>
224+
%2 = shufflevector <4 x i32> %1, <4 x i32> undef, <4 x i32> <i32 2, i32 1, i32 0, i32 3>
225+
ret <4 x i32> %2
226+
}
227+
; CHECK-LABEL: test20
228+
; CHECK: shufps $11
229+
; CHECK-NEXT: pshufd $-58
230+
; CHECK-NEXT: ret
231+
232+
233+
define <4 x i32> @test21(<4 x i32> %A, <4 x i32> %B) {
234+
%1 = shufflevector <4 x i32> %A, <4 x i32> %B, <4 x i32> <i32 4, i32 1, i32 3, i32 1>
235+
%2 = shufflevector <4 x i32> %1, <4 x i32> undef, <4 x i32> <i32 0, i32 1, i32 0, i32 3>
236+
ret <4 x i32> %2
237+
}
238+
; CHECK-LABEL: test21
239+
; CHECK: shufps $120
240+
; CHECK-NEXT: pshufd $-60
241+
; CHECK-NEXT: ret
242+
243+
244+
define <4 x i32> @test22(<4 x i32> %A, <4 x i32> %B) {
245+
%1 = shufflevector <4 x i32> %A, <4 x i32> %B, <4 x i32> <i32 4, i32 5, i32 2, i32 7>
246+
%2 = shufflevector <4 x i32> %1, <4 x i32> undef, <4 x i32> <i32 1, i32 1, i32 1, i32 3>
247+
ret <4 x i32> %2
248+
}
249+
; CHECK-LABEL: test22
250+
; CHECK: blendps $11
251+
; CHECK-NEXT: pshufd $-43
252+
; CHECK-NEXT: ret
253+

0 commit comments

Comments
 (0)