1 ; RUN: llc < %s -mattr=+sse2 -mtriple=i686-apple-darwin -mcpu=core2 | FileCheck %s -check-prefix=SSE2-Darwin
2 ; RUN: llc < %s -mattr=+sse2 -mtriple=i686-pc-mingw32 -mcpu=core2 | FileCheck %s -check-prefix=SSE2-Mingw32
3 ; RUN: llc < %s -mattr=+sse,-sse2 -mtriple=i686-apple-darwin -mcpu=core2 | FileCheck %s -check-prefix=SSE1
4 ; RUN: llc < %s -mattr=-sse -mtriple=i686-apple-darwin -mcpu=core2 | FileCheck %s -check-prefix=NOSSE
5 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=core2 | FileCheck %s -check-prefix=X86-64
6 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=nehalem | FileCheck %s -check-prefix=NHM_64
9 @.str = internal constant [25 x i8] c"image\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
10 @.str2 = internal constant [30 x i8] c"xxxxxxxxxxxxxxxxxxxxxxxxxxxxx\00", align 4
12 define void @t1(i32 %argc, ptr %argv) nounwind {
14 ; SSE2-Darwin-LABEL: t1:
15 ; SSE2-Darwin: movsd _.str+16, %xmm0
16 ; SSE2-Darwin: movsd %xmm0, 16(%esp)
17 ; SSE2-Darwin: movaps _.str, %xmm0
18 ; SSE2-Darwin: movaps %xmm0
19 ; SSE2-Darwin: movb $0, 24(%esp)
21 ; SSE2-Mingw32-LABEL: t1:
22 ; SSE2-Mingw32: movsd _.str+16, %xmm0
23 ; SSE2-Mingw32: movsd %xmm0, 16(%esp)
24 ; SSE2-Mingw32: movaps _.str, %xmm0
25 ; SSE2-Mingw32: movups %xmm0
26 ; SSE2-Mingw32: movb $0, 24(%esp)
29 ; SSE1: movaps _.str, %xmm0
31 ; SSE1: movb $0, 24(%esp)
32 ; SSE1: movl $0, 20(%esp)
33 ; SSE1: movl $0, 16(%esp)
42 ; NOSSE: movl $1734438249
45 ; X86-64: movaps _.str(%rip), %xmm0
46 ; X86-64: movaps %xmm0
49 %tmp1 = alloca [25 x i8]
50 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %tmp1, ptr align 1 @.str, i32 25, i1 false)
55 %struct.s0 = type { [2 x double] }
57 define void @t2(ptr nocapture %a, ptr nocapture %b) nounwind ssp {
59 ; SSE2-Darwin-LABEL: t2:
60 ; SSE2-Darwin: movaps (%ecx), %xmm0
61 ; SSE2-Darwin: movaps %xmm0, (%eax)
63 ; SSE2-Mingw32-LABEL: t2:
64 ; SSE2-Mingw32: movaps (%ecx), %xmm0
65 ; SSE2-Mingw32: movaps %xmm0, (%eax)
68 ; SSE1: movaps (%ecx), %xmm0
69 ; SSE1: movaps %xmm0, (%eax)
84 ; X86-64: movaps (%rsi), %xmm0
85 ; X86-64: movaps %xmm0, (%rdi)
86 tail call void @llvm.memcpy.p0.p0.i32(ptr align 16 %a, ptr align 16 %b, i32 16, i1 false)
90 define void @t3(ptr nocapture %a, ptr nocapture %b) nounwind ssp {
92 ; SSE2-Darwin-LABEL: t3:
93 ; SSE2-Darwin: movsd (%ecx), %xmm0
94 ; SSE2-Darwin: movsd 8(%ecx), %xmm1
95 ; SSE2-Darwin: movsd %xmm1, 8(%eax)
96 ; SSE2-Darwin: movsd %xmm0, (%eax)
98 ; SSE2-Mingw32-LABEL: t3:
99 ; SSE2-Mingw32: movsd (%ecx), %xmm0
100 ; SSE2-Mingw32: movsd 8(%ecx), %xmm1
101 ; SSE2-Mingw32: movsd %xmm1, 8(%eax)
102 ; SSE2-Mingw32: movsd %xmm0, (%eax)
129 ; X86-64: movq (%rsi), %rax
130 ; X86-64: movq 8(%rsi), %rcx
131 ; X86-64: movq %rcx, 8(%rdi)
132 ; X86-64: movq %rax, (%rdi)
133 tail call void @llvm.memcpy.p0.p0.i32(ptr align 8 %a, ptr align 8 %b, i32 16, i1 false)
137 define void @t4() nounwind {
139 ; SSE2-Darwin-LABEL: t4:
140 ; SSE2-Darwin: movw $120
141 ; SSE2-Darwin: movl $2021161080
142 ; SSE2-Darwin: movl $2021161080
143 ; SSE2-Darwin: movl $2021161080
144 ; SSE2-Darwin: movl $2021161080
145 ; SSE2-Darwin: movl $2021161080
146 ; SSE2-Darwin: movl $2021161080
147 ; SSE2-Darwin: movl $2021161080
149 ; SSE2-Mingw32-LABEL: t4:
150 ; SSE2-Mingw32: movw $120
151 ; SSE2-Mingw32: movl $2021161080
152 ; SSE2-Mingw32: movl $2021161080
153 ; SSE2-Mingw32: movl $2021161080
154 ; SSE2-Mingw32: movl $2021161080
155 ; SSE2-Mingw32: movl $2021161080
156 ; SSE2-Mingw32: movl $2021161080
157 ; SSE2-Mingw32: movl $2021161080
161 ; SSE1: movl $2021161080
162 ; SSE1: movl $2021161080
163 ; SSE1: movl $2021161080
164 ; SSE1: movl $2021161080
165 ; SSE1: movl $2021161080
166 ; SSE1: movl $2021161080
167 ; SSE1: movl $2021161080
171 ; NOSSE: movl $2021161080
172 ; NOSSE: movl $2021161080
173 ; NOSSE: movl $2021161080
174 ; NOSSE: movl $2021161080
175 ; NOSSE: movl $2021161080
176 ; NOSSE: movl $2021161080
177 ; NOSSE: movl $2021161080
179 ;;; TODO: (1) Some of the loads and stores are certainly unaligned and (2) the first load and first
180 ;;; store overlap with the second load and second store respectively.
182 ;;; Is either of the sequences ideal?
185 ; X86-64: movabsq $33909456017848440, %rax ## imm = 0x78787878787878
186 ; X86-64: movq %rax, -10(%rsp)
187 ; X86-64: movabsq $8680820740569200760, %rax ## imm = 0x7878787878787878
188 ; X86-64: movq %rax, -16(%rsp)
189 ; X86-64: movq %rax, -24(%rsp)
190 ; X86-64: movq %rax, -32(%rsp)
193 ; NHM_64: movups _.str2+14(%rip), %xmm0
194 ; NHM_64: movups %xmm0, -26(%rsp)
195 ; NHM_64: movups _.str2(%rip), %xmm0
196 ; NHM_64: movaps %xmm0, -40(%rsp)
198 %tmp1 = alloca [30 x i8]
199 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %tmp1, ptr align 1 @.str2, i32 30, i1 false)
203 declare void @llvm.memcpy.p0.p0.i32(ptr nocapture, ptr nocapture, i32, i1) nounwind