1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown -mattr=+mmx,+sse2 | FileCheck %s --check-prefix=X86
3 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+mmx,+sse2 | FileCheck %s --check-prefix=X64
5 define i32 @t0(i64 %x) nounwind {
7 ; X86: # %bb.0: # %entry
8 ; X86-NEXT: pshufw $238, {{[0-9]+}}(%esp), %mm0 # mm0 = mem[2,3,2,3]
9 ; X86-NEXT: movd %mm0, %eax
13 ; X64: # %bb.0: # %entry
14 ; X64-NEXT: movq %rdi, %mm0
15 ; X64-NEXT: pshufw $238, %mm0, %mm0 # mm0 = mm0[2,3,2,3]
16 ; X64-NEXT: movd %mm0, %eax
19 %0 = bitcast i64 %x to <4 x i16>
20 %1 = bitcast <4 x i16> %0 to x86_mmx
21 %2 = tail call x86_mmx @llvm.x86.sse.pshuf.w(x86_mmx %1, i8 -18)
22 %3 = bitcast x86_mmx %2 to <4 x i16>
23 %4 = bitcast <4 x i16> %3 to <1 x i64>
24 %5 = extractelement <1 x i64> %4, i32 0
25 %6 = bitcast i64 %5 to <2 x i32>
26 %7 = extractelement <2 x i32> %6, i32 0
30 define i64 @t1(i64 %x, i32 %n) nounwind {
32 ; X86: # %bb.0: # %entry
33 ; X86-NEXT: pushl %ebp
34 ; X86-NEXT: movl %esp, %ebp
35 ; X86-NEXT: andl $-8, %esp
36 ; X86-NEXT: subl $8, %esp
37 ; X86-NEXT: movq 8(%ebp), %mm0
38 ; X86-NEXT: movd 16(%ebp), %mm1
39 ; X86-NEXT: psllq %mm1, %mm0
40 ; X86-NEXT: movq %mm0, (%esp)
41 ; X86-NEXT: movl (%esp), %eax
42 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
43 ; X86-NEXT: movl %ebp, %esp
48 ; X64: # %bb.0: # %entry
49 ; X64-NEXT: movq %rdi, %mm0
50 ; X64-NEXT: movd %esi, %mm1
51 ; X64-NEXT: psllq %mm1, %mm0
52 ; X64-NEXT: movq %mm0, %rax
55 %0 = bitcast i64 %x to x86_mmx
56 %1 = tail call x86_mmx @llvm.x86.mmx.pslli.q(x86_mmx %0, i32 %n)
57 %2 = bitcast x86_mmx %1 to i64
61 define i64 @t2(i64 %x, i32 %n, i32 %w) nounwind {
63 ; X86: # %bb.0: # %entry
64 ; X86-NEXT: pushl %ebp
65 ; X86-NEXT: movl %esp, %ebp
66 ; X86-NEXT: andl $-8, %esp
67 ; X86-NEXT: subl $8, %esp
68 ; X86-NEXT: movd 20(%ebp), %mm0
69 ; X86-NEXT: movd 16(%ebp), %mm1
70 ; X86-NEXT: psllq %mm1, %mm0
71 ; X86-NEXT: por 8(%ebp), %mm0
72 ; X86-NEXT: movq %mm0, (%esp)
73 ; X86-NEXT: movl (%esp), %eax
74 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
75 ; X86-NEXT: movl %ebp, %esp
80 ; X64: # %bb.0: # %entry
81 ; X64-NEXT: movd %edx, %mm0
82 ; X64-NEXT: movd %esi, %mm1
83 ; X64-NEXT: psllq %mm1, %mm0
84 ; X64-NEXT: movq %rdi, %mm1
85 ; X64-NEXT: por %mm0, %mm1
86 ; X64-NEXT: movq %mm1, %rax
89 %0 = insertelement <2 x i32> undef, i32 %w, i32 0
90 %1 = insertelement <2 x i32> %0, i32 0, i32 1
91 %2 = bitcast <2 x i32> %1 to x86_mmx
92 %3 = tail call x86_mmx @llvm.x86.mmx.pslli.q(x86_mmx %2, i32 %n)
93 %4 = bitcast i64 %x to x86_mmx
94 %5 = tail call x86_mmx @llvm.x86.mmx.por(x86_mmx %4, x86_mmx %3)
95 %6 = bitcast x86_mmx %5 to i64
99 define i64 @t3(ptr %y, ptr %n) nounwind {
101 ; X86: # %bb.0: # %entry
102 ; X86-NEXT: pushl %ebp
103 ; X86-NEXT: movl %esp, %ebp
104 ; X86-NEXT: andl $-8, %esp
105 ; X86-NEXT: subl $8, %esp
106 ; X86-NEXT: movl 12(%ebp), %eax
107 ; X86-NEXT: movl 8(%ebp), %ecx
108 ; X86-NEXT: movq (%ecx), %mm0
109 ; X86-NEXT: movd (%eax), %mm1
110 ; X86-NEXT: psllq %mm1, %mm0
111 ; X86-NEXT: movq %mm0, (%esp)
112 ; X86-NEXT: movl (%esp), %eax
113 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
114 ; X86-NEXT: movl %ebp, %esp
115 ; X86-NEXT: popl %ebp
119 ; X64: # %bb.0: # %entry
120 ; X64-NEXT: movq (%rdi), %mm0
121 ; X64-NEXT: movd (%rsi), %mm1
122 ; X64-NEXT: psllq %mm1, %mm0
123 ; X64-NEXT: movq %mm0, %rax
126 %0 = load x86_mmx, ptr %y, align 8
127 %1 = load i32, ptr %n, align 4
128 %2 = tail call x86_mmx @llvm.x86.mmx.pslli.q(x86_mmx %0, i32 %1)
129 %3 = bitcast x86_mmx %2 to i64
133 declare x86_mmx @llvm.x86.sse.pshuf.w(x86_mmx, i8)
134 declare x86_mmx @llvm.x86.mmx.pslli.q(x86_mmx, i32)
135 declare x86_mmx @llvm.x86.mmx.por(x86_mmx, x86_mmx)