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=X86
3 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+sse2 | FileCheck %s --check-prefix=X64
5 ; When loading the shift amount from memory, avoid generating the splat.
7 define void @shift5a(<4 x i32> %val, ptr %dst, ptr %pamt) nounwind {
9 ; X86: # %bb.0: # %entry
10 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
11 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
12 ; X86-NEXT: movd {{.*#+}} xmm1 = mem[0],zero,zero,zero
13 ; X86-NEXT: pslld %xmm1, %xmm0
14 ; X86-NEXT: movdqa %xmm0, (%eax)
18 ; X64: # %bb.0: # %entry
19 ; X64-NEXT: movd {{.*#+}} xmm1 = mem[0],zero,zero,zero
20 ; X64-NEXT: pslld %xmm1, %xmm0
21 ; X64-NEXT: movdqa %xmm0, (%rdi)
24 %amt = load i32, ptr %pamt
25 %tmp0 = insertelement <4 x i32> undef, i32 %amt, i32 0
26 %shamt = shufflevector <4 x i32> %tmp0, <4 x i32> undef, <4 x i32> zeroinitializer
27 %shl = shl <4 x i32> %val, %shamt
28 store <4 x i32> %shl, ptr %dst
33 define void @shift5b(<4 x i32> %val, ptr %dst, ptr %pamt) nounwind {
35 ; X86: # %bb.0: # %entry
36 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
37 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
38 ; X86-NEXT: movd {{.*#+}} xmm1 = mem[0],zero,zero,zero
39 ; X86-NEXT: psrad %xmm1, %xmm0
40 ; X86-NEXT: movdqa %xmm0, (%eax)
44 ; X64: # %bb.0: # %entry
45 ; X64-NEXT: movd {{.*#+}} xmm1 = mem[0],zero,zero,zero
46 ; X64-NEXT: psrad %xmm1, %xmm0
47 ; X64-NEXT: movdqa %xmm0, (%rdi)
50 %amt = load i32, ptr %pamt
51 %tmp0 = insertelement <4 x i32> undef, i32 %amt, i32 0
52 %shamt = shufflevector <4 x i32> %tmp0, <4 x i32> undef, <4 x i32> zeroinitializer
53 %shr = ashr <4 x i32> %val, %shamt
54 store <4 x i32> %shr, ptr %dst
59 define void @shift5c(<4 x i32> %val, ptr %dst, i32 %amt) nounwind {
61 ; X86: # %bb.0: # %entry
62 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
63 ; X86-NEXT: movd {{.*#+}} xmm1 = mem[0],zero,zero,zero
64 ; X86-NEXT: pslld %xmm1, %xmm0
65 ; X86-NEXT: movdqa %xmm0, (%eax)
69 ; X64: # %bb.0: # %entry
70 ; X64-NEXT: movd %esi, %xmm1
71 ; X64-NEXT: pslld %xmm1, %xmm0
72 ; X64-NEXT: movdqa %xmm0, (%rdi)
75 %tmp0 = insertelement <4 x i32> undef, i32 %amt, i32 0
76 %shamt = shufflevector <4 x i32> %tmp0, <4 x i32> undef, <4 x i32> zeroinitializer
77 %shl = shl <4 x i32> %val, %shamt
78 store <4 x i32> %shl, ptr %dst
83 define void @shift5d(<4 x i32> %val, ptr %dst, i32 %amt) nounwind {
85 ; X86: # %bb.0: # %entry
86 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
87 ; X86-NEXT: movd {{.*#+}} xmm1 = mem[0],zero,zero,zero
88 ; X86-NEXT: psrad %xmm1, %xmm0
89 ; X86-NEXT: movdqa %xmm0, (%eax)
93 ; X64: # %bb.0: # %entry
94 ; X64-NEXT: movd %esi, %xmm1
95 ; X64-NEXT: psrad %xmm1, %xmm0
96 ; X64-NEXT: movdqa %xmm0, (%rdi)
99 %tmp0 = insertelement <4 x i32> undef, i32 %amt, i32 0
100 %shamt = shufflevector <4 x i32> %tmp0, <4 x i32> undef, <4 x i32> zeroinitializer
101 %shr = ashr <4 x i32> %val, %shamt
102 store <4 x i32> %shr, ptr %dst