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
7@.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"
8@.str2 = internal constant [30 x i8] c"xxxxxxxxxxxxxxxxxxxxxxxxxxxxx\00", align 4
9
10define void @t1(i32 %argc, i8** %argv) nounwind  {
11entry:
12; SSE2-Darwin-LABEL: t1:
13; SSE2-Darwin: movsd _.str+16, %xmm0
14; SSE2-Darwin: movsd %xmm0, 16(%esp)
15; SSE2-Darwin: movaps _.str, %xmm0
16; SSE2-Darwin: movaps %xmm0
17; SSE2-Darwin: movb $0, 24(%esp)
18
19; SSE2-Mingw32-LABEL: t1:
20; SSE2-Mingw32: movsd _.str+16, %xmm0
21; SSE2-Mingw32: movsd %xmm0, 16(%esp)
22; SSE2-Mingw32: movaps _.str, %xmm0
23; SSE2-Mingw32: movups %xmm0
24; SSE2-Mingw32: movb $0, 24(%esp)
25
26; SSE1-LABEL: t1:
27; SSE1: movaps _.str, %xmm0
28; SSE1: movaps %xmm0
29; SSE1: movb $0, 24(%esp)
30; SSE1: movl $0, 20(%esp)
31; SSE1: movl $0, 16(%esp)
32
33; NOSSE-LABEL: t1:
34; NOSSE: movb $0
35; NOSSE: movl $0
36; NOSSE: movl $0
37; NOSSE: movl $0
38; NOSSE: movl $0
39; NOSSE: movl $101
40; NOSSE: movl $1734438249
41
42; X86-64-LABEL: t1:
43; X86-64: movaps _.str(%rip), %xmm0
44; X86-64: movaps %xmm0
45; X86-64: movb $0
46; X86-64: movq $0
47  %tmp1 = alloca [25 x i8]
48  %tmp2 = bitcast [25 x i8]* %tmp1 to i8*
49  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp2, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i32 0, i32 0), i32 25, i32 1, i1 false)
50  unreachable
51}
52
53;rdar://7774704
54%struct.s0 = type { [2 x double] }
55
56define void @t2(%struct.s0* nocapture %a, %struct.s0* nocapture %b) nounwind ssp {
57entry:
58; SSE2-Darwin-LABEL: t2:
59; SSE2-Darwin: movaps (%ecx), %xmm0
60; SSE2-Darwin: movaps %xmm0, (%eax)
61
62; SSE2-Mingw32-LABEL: t2:
63; SSE2-Mingw32: movaps (%ecx), %xmm0
64; SSE2-Mingw32: movaps %xmm0, (%eax)
65
66; SSE1-LABEL: t2:
67; SSE1: movaps (%ecx), %xmm0
68; SSE1: movaps %xmm0, (%eax)
69
70; NOSSE-LABEL: t2:
71; NOSSE: movl
72; NOSSE: movl
73; NOSSE: movl
74; NOSSE: movl
75; NOSSE: movl
76; NOSSE: movl
77; NOSSE: movl
78; NOSSE: movl
79; NOSSE: movl
80; NOSSE: movl
81
82; X86-64-LABEL: t2:
83; X86-64: movaps (%rsi), %xmm0
84; X86-64: movaps %xmm0, (%rdi)
85  %tmp2 = bitcast %struct.s0* %a to i8*           ; <i8*> [#uses=1]
86  %tmp3 = bitcast %struct.s0* %b to i8*           ; <i8*> [#uses=1]
87  tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp2, i8* %tmp3, i32 16, i32 16, i1 false)
88  ret void
89}
90
91define void @t3(%struct.s0* nocapture %a, %struct.s0* nocapture %b) nounwind ssp {
92entry:
93; SSE2-Darwin-LABEL: t3:
94; SSE2-Darwin: movsd (%ecx), %xmm0
95; SSE2-Darwin: movsd 8(%ecx), %xmm1
96; SSE2-Darwin: movsd %xmm1, 8(%eax)
97; SSE2-Darwin: movsd %xmm0, (%eax)
98
99; SSE2-Mingw32-LABEL: t3:
100; SSE2-Mingw32: movsd (%ecx), %xmm0
101; SSE2-Mingw32: movsd 8(%ecx), %xmm1
102; SSE2-Mingw32: movsd %xmm1, 8(%eax)
103; SSE2-Mingw32: movsd %xmm0, (%eax)
104
105; SSE1-LABEL: t3:
106; SSE1: movl
107; SSE1: movl
108; SSE1: movl
109; SSE1: movl
110; SSE1: movl
111; SSE1: movl
112; SSE1: movl
113; SSE1: movl
114; SSE1: movl
115; SSE1: movl
116
117; NOSSE-LABEL: t3:
118; NOSSE: movl
119; NOSSE: movl
120; NOSSE: movl
121; NOSSE: movl
122; NOSSE: movl
123; NOSSE: movl
124; NOSSE: movl
125; NOSSE: movl
126; NOSSE: movl
127; NOSSE: movl
128
129; X86-64-LABEL: t3:
130; X86-64: movq (%rsi), %rax
131; X86-64: movq 8(%rsi), %rcx
132; X86-64: movq %rcx, 8(%rdi)
133; X86-64: movq %rax, (%rdi)
134  %tmp2 = bitcast %struct.s0* %a to i8*           ; <i8*> [#uses=1]
135  %tmp3 = bitcast %struct.s0* %b to i8*           ; <i8*> [#uses=1]
136  tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp2, i8* %tmp3, i32 16, i32 8, i1 false)
137  ret void
138}
139
140define void @t4() nounwind {
141entry:
142; SSE2-Darwin-LABEL: t4:
143; SSE2-Darwin: movw $120
144; SSE2-Darwin: movl $2021161080
145; SSE2-Darwin: movl $2021161080
146; SSE2-Darwin: movl $2021161080
147; SSE2-Darwin: movl $2021161080
148; SSE2-Darwin: movl $2021161080
149; SSE2-Darwin: movl $2021161080
150; SSE2-Darwin: movl $2021161080
151
152; SSE2-Mingw32-LABEL: t4:
153; SSE2-Mingw32: movw $120
154; SSE2-Mingw32: movl $2021161080
155; SSE2-Mingw32: movl $2021161080
156; SSE2-Mingw32: movl $2021161080
157; SSE2-Mingw32: movl $2021161080
158; SSE2-Mingw32: movl $2021161080
159; SSE2-Mingw32: movl $2021161080
160; SSE2-Mingw32: movl $2021161080
161
162; SSE1-LABEL: t4:
163; SSE1: movw $120
164; SSE1: movl $2021161080
165; SSE1: movl $2021161080
166; SSE1: movl $2021161080
167; SSE1: movl $2021161080
168; SSE1: movl $2021161080
169; SSE1: movl $2021161080
170; SSE1: movl $2021161080
171
172; NOSSE-LABEL: t4:
173; NOSSE: movw $120
174; NOSSE: movl $2021161080
175; NOSSE: movl $2021161080
176; NOSSE: movl $2021161080
177; NOSSE: movl $2021161080
178; NOSSE: movl $2021161080
179; NOSSE: movl $2021161080
180; NOSSE: movl $2021161080
181
182; X86-64-LABEL: t4:
183; X86-64: movabsq $8680820740569200760, %rax
184; X86-64: movq %rax
185; X86-64: movq %rax
186; X86-64: movq %rax
187; X86-64: movw $120
188; X86-64: movl $2021161080
189  %tmp1 = alloca [30 x i8]
190  %tmp2 = bitcast [30 x i8]* %tmp1 to i8*
191  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp2, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str2, i32 0, i32 0), i32 30, i32 1, i1 false)
192  unreachable
193}
194
195declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind
196