1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown -mattr=+sse2 | FileCheck %s --check-prefix=X32
3 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+sse2 | FileCheck %s --check-prefix=X64
5 ; Verify that we correctly fold target specific packed vector shifts by
6 ; immediate count into a simple build_vector when the elements of the vector
7 ; in input to the packed shift are all constants or undef.
9 define <8 x i16> @test1() {
12 ; X32-NEXT: movaps {{.*#+}} xmm0 = [8,16,32,64,8,16,32,64]
17 ; X64-NEXT: movaps {{.*#+}} xmm0 = [8,16,32,64,8,16,32,64]
19 %1 = tail call <8 x i16> @llvm.x86.sse2.pslli.w(<8 x i16> <i16 1, i16 2, i16 4, i16 8, i16 1, i16 2, i16 4, i16 8>, i32 3)
23 define <8 x i16> @test2() {
26 ; X32-NEXT: movaps {{.*#+}} xmm0 = [0,1,2,4,0,1,2,4]
31 ; X64-NEXT: movaps {{.*#+}} xmm0 = [0,1,2,4,0,1,2,4]
33 %1 = tail call <8 x i16> @llvm.x86.sse2.psrli.w(<8 x i16> <i16 4, i16 8, i16 16, i16 32, i16 4, i16 8, i16 16, i16 32>, i32 3)
37 define <8 x i16> @test3() {
40 ; X32-NEXT: movaps {{.*#+}} xmm0 = [0,1,2,4,0,1,2,4]
45 ; X64-NEXT: movaps {{.*#+}} xmm0 = [0,1,2,4,0,1,2,4]
47 %1 = tail call <8 x i16> @llvm.x86.sse2.psrai.w(<8 x i16> <i16 4, i16 8, i16 16, i16 32, i16 4, i16 8, i16 16, i16 32>, i32 3)
51 define <4 x i32> @test4() {
54 ; X32-NEXT: movaps {{.*#+}} xmm0 = [8,16,32,64]
59 ; X64-NEXT: movaps {{.*#+}} xmm0 = [8,16,32,64]
61 %1 = tail call <4 x i32> @llvm.x86.sse2.pslli.d(<4 x i32> <i32 1, i32 2, i32 4, i32 8>, i32 3)
65 define <4 x i32> @test5() {
68 ; X32-NEXT: movaps {{.*#+}} xmm0 = [0,1,2,4]
73 ; X64-NEXT: movaps {{.*#+}} xmm0 = [0,1,2,4]
75 %1 = tail call <4 x i32> @llvm.x86.sse2.psrli.d(<4 x i32> <i32 4, i32 8, i32 16, i32 32>, i32 3)
79 define <4 x i32> @test6() {
82 ; X32-NEXT: movaps {{.*#+}} xmm0 = [0,1,2,4]
87 ; X64-NEXT: movaps {{.*#+}} xmm0 = [0,1,2,4]
89 %1 = tail call <4 x i32> @llvm.x86.sse2.psrai.d(<4 x i32> <i32 4, i32 8, i32 16, i32 32>, i32 3)
93 define <2 x i64> @test7() {
96 ; X32-NEXT: movaps {{.*#+}} xmm0 = [8,0,16,0]
101 ; X64-NEXT: movaps {{.*#+}} xmm0 = [8,16]
103 %1 = tail call <2 x i64> @llvm.x86.sse2.pslli.q(<2 x i64> <i64 1, i64 2>, i32 3)
107 define <2 x i64> @test8() {
110 ; X32-NEXT: movaps {{.*#+}} xmm0 = [1,0,2,0]
115 ; X64-NEXT: movaps {{.*#+}} xmm0 = [1,2]
117 %1 = tail call <2 x i64> @llvm.x86.sse2.psrli.q(<2 x i64> <i64 8, i64 16>, i32 3)
121 define <8 x i16> @test9() {
124 ; X32-NEXT: movaps {{.*#+}} xmm0 = <1,1,u,u,3,u,8,16>
129 ; X64-NEXT: movaps {{.*#+}} xmm0 = <1,1,u,u,3,u,8,16>
131 %1 = tail call <8 x i16> @llvm.x86.sse2.psrai.w(<8 x i16> <i16 15, i16 8, i16 undef, i16 undef, i16 31, i16 undef, i16 64, i16 128>, i32 3)
135 define <4 x i32> @test10() {
138 ; X32-NEXT: movaps {{.*#+}} xmm0 = <u,1,u,4>
143 ; X64-NEXT: movaps {{.*#+}} xmm0 = <u,1,u,4>
145 %1 = tail call <4 x i32> @llvm.x86.sse2.psrai.d(<4 x i32> <i32 undef, i32 8, i32 undef, i32 32>, i32 3)
149 define <2 x i64> @test11() {
152 ; X32-NEXT: movaps {{.*#+}} xmm0 = <u,u,3,0>
157 ; X64-NEXT: movaps {{.*#+}} xmm0 = <u,3>
159 %1 = tail call <2 x i64> @llvm.x86.sse2.psrli.q(<2 x i64> <i64 undef, i64 31>, i32 3)
163 define <8 x i16> @test12() {
166 ; X32-NEXT: movaps {{.*#+}} xmm0 = <1,1,u,u,3,u,8,16>
171 ; X64-NEXT: movaps {{.*#+}} xmm0 = <1,1,u,u,3,u,8,16>
173 %1 = tail call <8 x i16> @llvm.x86.sse2.psrai.w(<8 x i16> <i16 15, i16 8, i16 undef, i16 undef, i16 31, i16 undef, i16 64, i16 128>, i32 3)
177 define <4 x i32> @test13() {
180 ; X32-NEXT: movaps {{.*#+}} xmm0 = <u,1,u,4>
185 ; X64-NEXT: movaps {{.*#+}} xmm0 = <u,1,u,4>
187 %1 = tail call <4 x i32> @llvm.x86.sse2.psrli.d(<4 x i32> <i32 undef, i32 8, i32 undef, i32 32>, i32 3)
191 define <8 x i16> @test14() {
194 ; X32-NEXT: movaps {{.*#+}} xmm0 = <1,1,u,u,3,u,8,16>
199 ; X64-NEXT: movaps {{.*#+}} xmm0 = <1,1,u,u,3,u,8,16>
201 %1 = tail call <8 x i16> @llvm.x86.sse2.psrli.w(<8 x i16> <i16 15, i16 8, i16 undef, i16 undef, i16 31, i16 undef, i16 64, i16 128>, i32 3)
205 define <4 x i32> @test15() {
208 ; X32-NEXT: movaps {{.*#+}} xmm0 = <u,64,u,256>
213 ; X64-NEXT: movaps {{.*#+}} xmm0 = <u,64,u,256>
215 %1 = tail call <4 x i32> @llvm.x86.sse2.pslli.d(<4 x i32> <i32 undef, i32 8, i32 undef, i32 32>, i32 3)
219 define <2 x i64> @test16() {
222 ; X32-NEXT: movaps {{.*#+}} xmm0 = <u,u,248,0>
227 ; X64-NEXT: movaps {{.*#+}} xmm0 = <u,248>
229 %1 = tail call <2 x i64> @llvm.x86.sse2.pslli.q(<2 x i64> <i64 undef, i64 31>, i32 3)
233 declare <8 x i16> @llvm.x86.sse2.pslli.w(<8 x i16>, i32)
234 declare <8 x i16> @llvm.x86.sse2.psrli.w(<8 x i16>, i32)
235 declare <8 x i16> @llvm.x86.sse2.psrai.w(<8 x i16>, i32)
236 declare <4 x i32> @llvm.x86.sse2.pslli.d(<4 x i32>, i32)
237 declare <4 x i32> @llvm.x86.sse2.psrli.d(<4 x i32>, i32)
238 declare <4 x i32> @llvm.x86.sse2.psrai.d(<4 x i32>, i32)
239 declare <2 x i64> @llvm.x86.sse2.pslli.q(<2 x i64>, i32)
240 declare <2 x i64> @llvm.x86.sse2.psrli.q(<2 x i64>, i32)