1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=x86_64-unknown-linux-gnu -o - -mattr=-x87,+sse,-sse2 %s  | FileCheck --check-prefixes=X64SSE %s
3; RUN: llc -mtriple=i686-unknown-linux-gnu -o - -mattr=-x87,+sse,-sse2 %s    | FileCheck --check-prefixes=X86SSE %s
4; RUN: llc -mtriple=x86_64-unknown-linux-gnu -o - -mattr=-x87,+sse2,-sse3 %s | FileCheck --check-prefixes=X64SSE2 %s
5; RUN: llc -mtriple=i686-unknown-linux-gnu -o - -mattr=-x87,+sse2,-sse3 %s   | FileCheck --check-prefixes=X86SSE2 %s
6; RUN: llc -mtriple=x86_64-unknown-linux-gnu -o - -mattr=-x87,+avx,-avx2 %s  | FileCheck --check-prefixes=X64AVX %s
7; RUN: llc -mtriple=i686-unknown-linux-gnu -o - -mattr=-x87,+avx,-avx2 %s    | FileCheck --check-prefixes=X86AVX %s
8
9
10%struct.params = type { double, double }
11
12define i32 @pr38738() {
13; X64SSE-LABEL: pr38738:
14; X64SSE:       # %bb.0: # %entry
15; X64SSE-NEXT:    xorps %xmm0, %xmm0
16; X64SSE-NEXT:    movaps %xmm0, -{{[0-9]+}}(%rsp)
17; X64SSE-NEXT:    movl $0, -{{[0-9]+}}(%rsp)
18; X64SSE-NEXT:    movl -{{[0-9]+}}(%rsp), %eax
19; X64SSE-NEXT:    retq
20;
21; X86SSE-LABEL: pr38738:
22; X86SSE:       # %bb.0: # %entry
23; X86SSE-NEXT:    subl $28, %esp
24; X86SSE-NEXT:    .cfi_def_cfa_offset 32
25; X86SSE-NEXT:    movl $0, {{[0-9]+}}(%esp)
26; X86SSE-NEXT:    movl $0, {{[0-9]+}}(%esp)
27; X86SSE-NEXT:    movl $0, {{[0-9]+}}(%esp)
28; X86SSE-NEXT:    movl $0, (%esp)
29; X86SSE-NEXT:    movl $0, {{[0-9]+}}(%esp)
30; X86SSE-NEXT:    movl {{[0-9]+}}(%esp), %eax
31; X86SSE-NEXT:    addl $28, %esp
32; X86SSE-NEXT:    .cfi_def_cfa_offset 4
33; X86SSE-NEXT:    retl
34;
35; X64SSE2-LABEL: pr38738:
36; X64SSE2:       # %bb.0: # %entry
37; X64SSE2-NEXT:    xorps %xmm0, %xmm0
38; X64SSE2-NEXT:    movaps %xmm0, -{{[0-9]+}}(%rsp)
39; X64SSE2-NEXT:    movl $0, -{{[0-9]+}}(%rsp)
40; X64SSE2-NEXT:    movl -{{[0-9]+}}(%rsp), %eax
41; X64SSE2-NEXT:    retq
42;
43; X86SSE2-LABEL: pr38738:
44; X86SSE2:       # %bb.0: # %entry
45; X86SSE2-NEXT:    subl $44, %esp
46; X86SSE2-NEXT:    .cfi_def_cfa_offset 48
47; X86SSE2-NEXT:    xorps %xmm0, %xmm0
48; X86SSE2-NEXT:    movaps %xmm0, {{[0-9]+}}(%esp)
49; X86SSE2-NEXT:    movl $0, {{[0-9]+}}(%esp)
50; X86SSE2-NEXT:    movl {{[0-9]+}}(%esp), %eax
51; X86SSE2-NEXT:    addl $44, %esp
52; X86SSE2-NEXT:    .cfi_def_cfa_offset 4
53; X86SSE2-NEXT:    retl
54;
55; X64AVX-LABEL: pr38738:
56; X64AVX:       # %bb.0: # %entry
57; X64AVX-NEXT:    vxorps %xmm0, %xmm0, %xmm0
58; X64AVX-NEXT:    vmovaps %xmm0, -{{[0-9]+}}(%rsp)
59; X64AVX-NEXT:    movl $0, -{{[0-9]+}}(%rsp)
60; X64AVX-NEXT:    movl -{{[0-9]+}}(%rsp), %eax
61; X64AVX-NEXT:    retq
62;
63; X86AVX-LABEL: pr38738:
64; X86AVX:       # %bb.0: # %entry
65; X86AVX-NEXT:    subl $44, %esp
66; X86AVX-NEXT:    .cfi_def_cfa_offset 48
67; X86AVX-NEXT:    vxorps %xmm0, %xmm0, %xmm0
68; X86AVX-NEXT:    vmovaps %xmm0, {{[0-9]+}}(%esp)
69; X86AVX-NEXT:    movl $0, {{[0-9]+}}(%esp)
70; X86AVX-NEXT:    movl {{[0-9]+}}(%esp), %eax
71; X86AVX-NEXT:    addl $44, %esp
72; X86AVX-NEXT:    .cfi_def_cfa_offset 4
73; X86AVX-NEXT:    retl
74entry:
75  %retval = alloca i32, align 4
76  %dlg_sys_param = alloca %struct.params, align 8
77  %total_active_bw = alloca float, align 4
78  %0 = bitcast %struct.params* %dlg_sys_param to i8*
79  call void @llvm.memset.p0i8.i64(i8* align 8 %0, i8 0, i64 16, i1 false)
80  store float 0.000000e+00, float* %total_active_bw, align 4
81  %1 = load i32, i32* %retval, align 4
82  ret i32 %1
83}
84
85define void @tryset(i8* nocapture %x) {
86; X64SSE-LABEL: tryset:
87; X64SSE:       # %bb.0:
88; X64SSE-NEXT:    movq $0, 56(%rdi)
89; X64SSE-NEXT:    movq $0, 48(%rdi)
90; X64SSE-NEXT:    movq $0, 40(%rdi)
91; X64SSE-NEXT:    movq $0, 32(%rdi)
92; X64SSE-NEXT:    movq $0, 24(%rdi)
93; X64SSE-NEXT:    movq $0, 16(%rdi)
94; X64SSE-NEXT:    movq $0, 8(%rdi)
95; X64SSE-NEXT:    movq $0, (%rdi)
96; X64SSE-NEXT:    retq
97;
98; X86SSE-LABEL: tryset:
99; X86SSE:       # %bb.0:
100; X86SSE-NEXT:    movl {{[0-9]+}}(%esp), %eax
101; X86SSE-NEXT:    movl $0, 60(%eax)
102; X86SSE-NEXT:    movl $0, 56(%eax)
103; X86SSE-NEXT:    movl $0, 52(%eax)
104; X86SSE-NEXT:    movl $0, 48(%eax)
105; X86SSE-NEXT:    movl $0, 44(%eax)
106; X86SSE-NEXT:    movl $0, 40(%eax)
107; X86SSE-NEXT:    movl $0, 36(%eax)
108; X86SSE-NEXT:    movl $0, 32(%eax)
109; X86SSE-NEXT:    movl $0, 28(%eax)
110; X86SSE-NEXT:    movl $0, 24(%eax)
111; X86SSE-NEXT:    movl $0, 20(%eax)
112; X86SSE-NEXT:    movl $0, 16(%eax)
113; X86SSE-NEXT:    movl $0, 12(%eax)
114; X86SSE-NEXT:    movl $0, 8(%eax)
115; X86SSE-NEXT:    movl $0, 4(%eax)
116; X86SSE-NEXT:    movl $0, (%eax)
117; X86SSE-NEXT:    retl
118;
119; X64SSE2-LABEL: tryset:
120; X64SSE2:       # %bb.0:
121; X64SSE2-NEXT:    movq $0, 56(%rdi)
122; X64SSE2-NEXT:    movq $0, 48(%rdi)
123; X64SSE2-NEXT:    movq $0, 40(%rdi)
124; X64SSE2-NEXT:    movq $0, 32(%rdi)
125; X64SSE2-NEXT:    movq $0, 24(%rdi)
126; X64SSE2-NEXT:    movq $0, 16(%rdi)
127; X64SSE2-NEXT:    movq $0, 8(%rdi)
128; X64SSE2-NEXT:    movq $0, (%rdi)
129; X64SSE2-NEXT:    retq
130;
131; X86SSE2-LABEL: tryset:
132; X86SSE2:       # %bb.0:
133; X86SSE2-NEXT:    movl {{[0-9]+}}(%esp), %eax
134; X86SSE2-NEXT:    movl $0, 4(%eax)
135; X86SSE2-NEXT:    movl $0, (%eax)
136; X86SSE2-NEXT:    movl $0, 12(%eax)
137; X86SSE2-NEXT:    movl $0, 8(%eax)
138; X86SSE2-NEXT:    movl $0, 20(%eax)
139; X86SSE2-NEXT:    movl $0, 16(%eax)
140; X86SSE2-NEXT:    movl $0, 28(%eax)
141; X86SSE2-NEXT:    movl $0, 24(%eax)
142; X86SSE2-NEXT:    movl $0, 36(%eax)
143; X86SSE2-NEXT:    movl $0, 32(%eax)
144; X86SSE2-NEXT:    movl $0, 44(%eax)
145; X86SSE2-NEXT:    movl $0, 40(%eax)
146; X86SSE2-NEXT:    movl $0, 52(%eax)
147; X86SSE2-NEXT:    movl $0, 48(%eax)
148; X86SSE2-NEXT:    movl $0, 60(%eax)
149; X86SSE2-NEXT:    movl $0, 56(%eax)
150; X86SSE2-NEXT:    retl
151;
152; X64AVX-LABEL: tryset:
153; X64AVX:       # %bb.0:
154; X64AVX-NEXT:    vxorps %xmm0, %xmm0, %xmm0
155; X64AVX-NEXT:    vmovups %ymm0, 32(%rdi)
156; X64AVX-NEXT:    vmovups %ymm0, (%rdi)
157; X64AVX-NEXT:    vzeroupper
158; X64AVX-NEXT:    retq
159;
160; X86AVX-LABEL: tryset:
161; X86AVX:       # %bb.0:
162; X86AVX-NEXT:    movl {{[0-9]+}}(%esp), %eax
163; X86AVX-NEXT:    vxorps %xmm0, %xmm0, %xmm0
164; X86AVX-NEXT:    vmovups %ymm0, 32(%eax)
165; X86AVX-NEXT:    vmovups %ymm0, (%eax)
166; X86AVX-NEXT:    vzeroupper
167; X86AVX-NEXT:    retl
168  tail call void @llvm.memset.p0i8.i64(i8* align 1 %x, i8 0, i64 64, i1 false)
169  ret void
170}
171
172define void @trycpy(i8* nocapture %x, i8* nocapture readonly %y) {
173; X64SSE-LABEL: trycpy:
174; X64SSE:       # %bb.0:
175; X64SSE-NEXT:    movq 24(%rsi), %rax
176; X64SSE-NEXT:    movq %rax, 24(%rdi)
177; X64SSE-NEXT:    movq 16(%rsi), %rax
178; X64SSE-NEXT:    movq %rax, 16(%rdi)
179; X64SSE-NEXT:    movq (%rsi), %rax
180; X64SSE-NEXT:    movq 8(%rsi), %rcx
181; X64SSE-NEXT:    movq %rcx, 8(%rdi)
182; X64SSE-NEXT:    movq %rax, (%rdi)
183; X64SSE-NEXT:    retq
184;
185; X86SSE-LABEL: trycpy:
186; X86SSE:       # %bb.0:
187; X86SSE-NEXT:    movl {{[0-9]+}}(%esp), %eax
188; X86SSE-NEXT:    movl {{[0-9]+}}(%esp), %ecx
189; X86SSE-NEXT:    movl 28(%ecx), %edx
190; X86SSE-NEXT:    movl %edx, 28(%eax)
191; X86SSE-NEXT:    movl 24(%ecx), %edx
192; X86SSE-NEXT:    movl %edx, 24(%eax)
193; X86SSE-NEXT:    movl 20(%ecx), %edx
194; X86SSE-NEXT:    movl %edx, 20(%eax)
195; X86SSE-NEXT:    movl 16(%ecx), %edx
196; X86SSE-NEXT:    movl %edx, 16(%eax)
197; X86SSE-NEXT:    movl 12(%ecx), %edx
198; X86SSE-NEXT:    movl %edx, 12(%eax)
199; X86SSE-NEXT:    movl 8(%ecx), %edx
200; X86SSE-NEXT:    movl %edx, 8(%eax)
201; X86SSE-NEXT:    movl (%ecx), %edx
202; X86SSE-NEXT:    movl 4(%ecx), %ecx
203; X86SSE-NEXT:    movl %ecx, 4(%eax)
204; X86SSE-NEXT:    movl %edx, (%eax)
205; X86SSE-NEXT:    retl
206;
207; X64SSE2-LABEL: trycpy:
208; X64SSE2:       # %bb.0:
209; X64SSE2-NEXT:    movq 24(%rsi), %rax
210; X64SSE2-NEXT:    movq %rax, 24(%rdi)
211; X64SSE2-NEXT:    movq 16(%rsi), %rax
212; X64SSE2-NEXT:    movq %rax, 16(%rdi)
213; X64SSE2-NEXT:    movq (%rsi), %rax
214; X64SSE2-NEXT:    movq 8(%rsi), %rcx
215; X64SSE2-NEXT:    movq %rcx, 8(%rdi)
216; X64SSE2-NEXT:    movq %rax, (%rdi)
217; X64SSE2-NEXT:    retq
218;
219; X86SSE2-LABEL: trycpy:
220; X86SSE2:       # %bb.0:
221; X86SSE2-NEXT:    movl {{[0-9]+}}(%esp), %eax
222; X86SSE2-NEXT:    movl {{[0-9]+}}(%esp), %ecx
223; X86SSE2-NEXT:    movsd {{.*#+}} xmm0 = mem[0],zero
224; X86SSE2-NEXT:    movsd %xmm0, 24(%eax)
225; X86SSE2-NEXT:    movsd {{.*#+}} xmm0 = mem[0],zero
226; X86SSE2-NEXT:    movsd %xmm0, 16(%eax)
227; X86SSE2-NEXT:    movsd {{.*#+}} xmm0 = mem[0],zero
228; X86SSE2-NEXT:    movsd {{.*#+}} xmm1 = mem[0],zero
229; X86SSE2-NEXT:    movsd %xmm1, 8(%eax)
230; X86SSE2-NEXT:    movsd %xmm0, (%eax)
231; X86SSE2-NEXT:    retl
232;
233; X64AVX-LABEL: trycpy:
234; X64AVX:       # %bb.0:
235; X64AVX-NEXT:    vmovups (%rsi), %ymm0
236; X64AVX-NEXT:    vmovups %ymm0, (%rdi)
237; X64AVX-NEXT:    vzeroupper
238; X64AVX-NEXT:    retq
239;
240; X86AVX-LABEL: trycpy:
241; X86AVX:       # %bb.0:
242; X86AVX-NEXT:    movl {{[0-9]+}}(%esp), %eax
243; X86AVX-NEXT:    movl {{[0-9]+}}(%esp), %ecx
244; X86AVX-NEXT:    vmovups (%ecx), %ymm0
245; X86AVX-NEXT:    vmovups %ymm0, (%eax)
246; X86AVX-NEXT:    vzeroupper
247; X86AVX-NEXT:    retl
248  tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %x, i8* align 1 %y, i64 32, i1 false)
249  ret void
250}
251
252declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1) argmemonly nounwind
253declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1) #2
254
255