1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
3 ; RUN: llc -verify-machineinstrs < %s -mtriple=x86_64-unknown-unknown -O0 | FileCheck --check-prefix=CHECK-O0 %s
7 ; Test how llvm handles return type of {i16, i8}. The return value will be
8 ; passed in %eax and %dl.
9 define i16 @test(i32 %key) {
11 ; CHECK: # %bb.0: # %entry
12 ; CHECK-NEXT: pushq %rax
13 ; CHECK-NEXT: .cfi_def_cfa_offset 16
14 ; CHECK-NEXT: movl %edi, {{[0-9]+}}(%rsp)
15 ; CHECK-NEXT: callq gen
16 ; CHECK-NEXT: # kill: def $ax killed $ax def $eax
17 ; CHECK-NEXT: movsbl %dl, %ecx
18 ; CHECK-NEXT: addl %ecx, %eax
19 ; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
20 ; CHECK-NEXT: popq %rcx
21 ; CHECK-NEXT: .cfi_def_cfa_offset 8
24 ; CHECK-O0-LABEL: test:
25 ; CHECK-O0: # %bb.0: # %entry
26 ; CHECK-O0-NEXT: pushq %rax
27 ; CHECK-O0-NEXT: .cfi_def_cfa_offset 16
28 ; CHECK-O0-NEXT: movl %edi, {{[0-9]+}}(%rsp)
29 ; CHECK-O0-NEXT: movl {{[0-9]+}}(%rsp), %edi
30 ; CHECK-O0-NEXT: callq gen
31 ; CHECK-O0-NEXT: movswl %ax, %edi
32 ; CHECK-O0-NEXT: movsbl %dl, %ecx
33 ; CHECK-O0-NEXT: addl %ecx, %edi
34 ; CHECK-O0-NEXT: movw %di, %ax
35 ; CHECK-O0-NEXT: popq %rcx
36 ; CHECK-O0-NEXT: .cfi_def_cfa_offset 8
39 %key.addr = alloca i32, align 4
40 store i32 %key, i32* %key.addr, align 4
41 %0 = load i32, i32* %key.addr, align 4
42 %call = call swiftcc { i16, i8 } @gen(i32 %0)
43 %v3 = extractvalue { i16, i8 } %call, 0
44 %v1 = sext i16 %v3 to i32
45 %v5 = extractvalue { i16, i8 } %call, 1
46 %v2 = sext i8 %v5 to i32
47 %add = add nsw i32 %v1, %v2
48 %conv = trunc i32 %add to i16
52 declare swiftcc { i16, i8 } @gen(i32)
54 ; If we can't pass every return value in register, we will pass everything
55 ; in memroy. The caller provides space for the return value and passes
56 ; the address in %rax. The first input argument will be in %rdi.
57 define i32 @test2(i32 %key) #0 {
59 ; CHECK: # %bb.0: # %entry
60 ; CHECK-NEXT: subq $24, %rsp
61 ; CHECK-NEXT: .cfi_def_cfa_offset 32
62 ; CHECK-NEXT: movl %edi, {{[0-9]+}}(%rsp)
63 ; CHECK-NEXT: movq %rsp, %rax
64 ; CHECK-NEXT: callq gen2
65 ; CHECK-NEXT: movl (%rsp), %eax
66 ; CHECK-NEXT: addl {{[0-9]+}}(%rsp), %eax
67 ; CHECK-NEXT: addl {{[0-9]+}}(%rsp), %eax
68 ; CHECK-NEXT: addl {{[0-9]+}}(%rsp), %eax
69 ; CHECK-NEXT: addl {{[0-9]+}}(%rsp), %eax
70 ; CHECK-NEXT: addq $24, %rsp
71 ; CHECK-NEXT: .cfi_def_cfa_offset 8
74 ; CHECK-O0-LABEL: test2:
75 ; CHECK-O0: # %bb.0: # %entry
76 ; CHECK-O0-NEXT: subq $24, %rsp
77 ; CHECK-O0-NEXT: .cfi_def_cfa_offset 32
78 ; CHECK-O0-NEXT: movl %edi, {{[0-9]+}}(%rsp)
79 ; CHECK-O0-NEXT: movl {{[0-9]+}}(%rsp), %edi
80 ; CHECK-O0-NEXT: movq %rsp, %rax
81 ; CHECK-O0-NEXT: callq gen2
82 ; CHECK-O0-NEXT: movl {{[0-9]+}}(%rsp), %edi
83 ; CHECK-O0-NEXT: movl {{[0-9]+}}(%rsp), %ecx
84 ; CHECK-O0-NEXT: movl {{[0-9]+}}(%rsp), %edx
85 ; CHECK-O0-NEXT: movl (%rsp), %esi
86 ; CHECK-O0-NEXT: movl {{[0-9]+}}(%rsp), %r8d
87 ; CHECK-O0-NEXT: addl %r8d, %esi
88 ; CHECK-O0-NEXT: addl %edx, %esi
89 ; CHECK-O0-NEXT: addl %ecx, %esi
90 ; CHECK-O0-NEXT: addl %edi, %esi
91 ; CHECK-O0-NEXT: movl %esi, %eax
92 ; CHECK-O0-NEXT: addq $24, %rsp
93 ; CHECK-O0-NEXT: .cfi_def_cfa_offset 8
96 %key.addr = alloca i32, align 4
97 store i32 %key, i32* %key.addr, align 4
98 %0 = load i32, i32* %key.addr, align 4
99 %call = call swiftcc { i32, i32, i32, i32, i32 } @gen2(i32 %0)
101 %v3 = extractvalue { i32, i32, i32, i32, i32 } %call, 0
102 %v5 = extractvalue { i32, i32, i32, i32, i32 } %call, 1
103 %v6 = extractvalue { i32, i32, i32, i32, i32 } %call, 2
104 %v7 = extractvalue { i32, i32, i32, i32, i32 } %call, 3
105 %v8 = extractvalue { i32, i32, i32, i32, i32 } %call, 4
107 %add = add nsw i32 %v3, %v5
108 %add1 = add nsw i32 %add, %v6
109 %add2 = add nsw i32 %add1, %v7
110 %add3 = add nsw i32 %add2, %v8
114 ; The address of the return value is passed in %rax.
115 ; On return, we don't keep the address in %rax.
116 define swiftcc { i32, i32, i32, i32, i32 } @gen2(i32 %key) {
119 ; CHECK-NEXT: movl %edi, 16(%rax)
120 ; CHECK-NEXT: movl %edi, 12(%rax)
121 ; CHECK-NEXT: movl %edi, 8(%rax)
122 ; CHECK-NEXT: movl %edi, 4(%rax)
123 ; CHECK-NEXT: movl %edi, (%rax)
126 ; CHECK-O0-LABEL: gen2:
128 ; CHECK-O0-NEXT: movl %edi, 16(%rax)
129 ; CHECK-O0-NEXT: movl %edi, 12(%rax)
130 ; CHECK-O0-NEXT: movl %edi, 8(%rax)
131 ; CHECK-O0-NEXT: movl %edi, 4(%rax)
132 ; CHECK-O0-NEXT: movl %edi, (%rax)
133 ; CHECK-O0-NEXT: retq
134 %Y = insertvalue { i32, i32, i32, i32, i32 } undef, i32 %key, 0
135 %Z = insertvalue { i32, i32, i32, i32, i32 } %Y, i32 %key, 1
136 %Z2 = insertvalue { i32, i32, i32, i32, i32 } %Z, i32 %key, 2
137 %Z3 = insertvalue { i32, i32, i32, i32, i32 } %Z2, i32 %key, 3
138 %Z4 = insertvalue { i32, i32, i32, i32, i32 } %Z3, i32 %key, 4
139 ret { i32, i32, i32, i32, i32 } %Z4
142 ; The return value {i32, i32, i32, i32} will be returned via registers %eax,
144 define i32 @test3(i32 %key) #0 {
145 ; CHECK-LABEL: test3:
146 ; CHECK: # %bb.0: # %entry
147 ; CHECK-NEXT: pushq %rax
148 ; CHECK-NEXT: .cfi_def_cfa_offset 16
149 ; CHECK-NEXT: movl %edi, {{[0-9]+}}(%rsp)
150 ; CHECK-NEXT: callq gen3
151 ; CHECK-NEXT: addl %edx, %eax
152 ; CHECK-NEXT: addl %ecx, %eax
153 ; CHECK-NEXT: addl %r8d, %eax
154 ; CHECK-NEXT: popq %rcx
155 ; CHECK-NEXT: .cfi_def_cfa_offset 8
158 ; CHECK-O0-LABEL: test3:
159 ; CHECK-O0: # %bb.0: # %entry
160 ; CHECK-O0-NEXT: pushq %rax
161 ; CHECK-O0-NEXT: .cfi_def_cfa_offset 16
162 ; CHECK-O0-NEXT: movl %edi, {{[0-9]+}}(%rsp)
163 ; CHECK-O0-NEXT: movl {{[0-9]+}}(%rsp), %edi
164 ; CHECK-O0-NEXT: callq gen3
165 ; CHECK-O0-NEXT: addl %edx, %eax
166 ; CHECK-O0-NEXT: addl %ecx, %eax
167 ; CHECK-O0-NEXT: addl %r8d, %eax
168 ; CHECK-O0-NEXT: popq %rcx
169 ; CHECK-O0-NEXT: .cfi_def_cfa_offset 8
170 ; CHECK-O0-NEXT: retq
172 %key.addr = alloca i32, align 4
173 store i32 %key, i32* %key.addr, align 4
174 %0 = load i32, i32* %key.addr, align 4
175 %call = call swiftcc { i32, i32, i32, i32 } @gen3(i32 %0)
177 %v3 = extractvalue { i32, i32, i32, i32 } %call, 0
178 %v5 = extractvalue { i32, i32, i32, i32 } %call, 1
179 %v6 = extractvalue { i32, i32, i32, i32 } %call, 2
180 %v7 = extractvalue { i32, i32, i32, i32 } %call, 3
182 %add = add nsw i32 %v3, %v5
183 %add1 = add nsw i32 %add, %v6
184 %add2 = add nsw i32 %add1, %v7
188 declare swiftcc { i32, i32, i32, i32 } @gen3(i32 %key)
190 ; The return value {float, float, float, float} will be returned via registers
191 ; %xmm0, %xmm1, %xmm2, %xmm3.
192 define float @test4(float %key) #0 {
193 ; CHECK-LABEL: test4:
194 ; CHECK: # %bb.0: # %entry
195 ; CHECK-NEXT: pushq %rax
196 ; CHECK-NEXT: .cfi_def_cfa_offset 16
197 ; CHECK-NEXT: movss %xmm0, {{[0-9]+}}(%rsp)
198 ; CHECK-NEXT: callq gen4
199 ; CHECK-NEXT: addss %xmm1, %xmm0
200 ; CHECK-NEXT: addss %xmm2, %xmm0
201 ; CHECK-NEXT: addss %xmm3, %xmm0
202 ; CHECK-NEXT: popq %rax
203 ; CHECK-NEXT: .cfi_def_cfa_offset 8
206 ; CHECK-O0-LABEL: test4:
207 ; CHECK-O0: # %bb.0: # %entry
208 ; CHECK-O0-NEXT: pushq %rax
209 ; CHECK-O0-NEXT: .cfi_def_cfa_offset 16
210 ; CHECK-O0-NEXT: movss %xmm0, {{[0-9]+}}(%rsp)
211 ; CHECK-O0-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
212 ; CHECK-O0-NEXT: callq gen4
213 ; CHECK-O0-NEXT: addss %xmm1, %xmm0
214 ; CHECK-O0-NEXT: addss %xmm2, %xmm0
215 ; CHECK-O0-NEXT: addss %xmm3, %xmm0
216 ; CHECK-O0-NEXT: popq %rax
217 ; CHECK-O0-NEXT: .cfi_def_cfa_offset 8
218 ; CHECK-O0-NEXT: retq
220 %key.addr = alloca float, align 4
221 store float %key, float* %key.addr, align 4
222 %0 = load float, float* %key.addr, align 4
223 %call = call swiftcc { float, float, float, float } @gen4(float %0)
225 %v3 = extractvalue { float, float, float, float } %call, 0
226 %v5 = extractvalue { float, float, float, float } %call, 1
227 %v6 = extractvalue { float, float, float, float } %call, 2
228 %v7 = extractvalue { float, float, float, float } %call, 3
230 %add = fadd float %v3, %v5
231 %add1 = fadd float %add, %v6
232 %add2 = fadd float %add1, %v7
236 declare swiftcc { float, float, float, float } @gen4(float %key)
238 define void @consume_i1_ret() {
239 ; CHECK-LABEL: consume_i1_ret:
241 ; CHECK-NEXT: pushq %rax
242 ; CHECK-NEXT: .cfi_def_cfa_offset 16
243 ; CHECK-NEXT: callq produce_i1_ret
244 ; CHECK-NEXT: movzbl %al, %eax
245 ; CHECK-NEXT: andl $1, %eax
246 ; CHECK-NEXT: movl %eax, {{.*}}(%rip)
247 ; CHECK-NEXT: movzbl %dl, %eax
248 ; CHECK-NEXT: andl $1, %eax
249 ; CHECK-NEXT: movl %eax, {{.*}}(%rip)
250 ; CHECK-NEXT: movzbl %cl, %eax
251 ; CHECK-NEXT: andl $1, %eax
252 ; CHECK-NEXT: movl %eax, {{.*}}(%rip)
253 ; CHECK-NEXT: movzbl %r8b, %eax
254 ; CHECK-NEXT: andl $1, %eax
255 ; CHECK-NEXT: movl %eax, {{.*}}(%rip)
256 ; CHECK-NEXT: popq %rax
257 ; CHECK-NEXT: .cfi_def_cfa_offset 8
260 ; CHECK-O0-LABEL: consume_i1_ret:
262 ; CHECK-O0-NEXT: pushq %rax
263 ; CHECK-O0-NEXT: .cfi_def_cfa_offset 16
264 ; CHECK-O0-NEXT: callq produce_i1_ret
265 ; CHECK-O0-NEXT: andb $1, %al
266 ; CHECK-O0-NEXT: movzbl %al, %esi
267 ; CHECK-O0-NEXT: movl %esi, var
268 ; CHECK-O0-NEXT: andb $1, %dl
269 ; CHECK-O0-NEXT: movzbl %dl, %esi
270 ; CHECK-O0-NEXT: movl %esi, var
271 ; CHECK-O0-NEXT: andb $1, %cl
272 ; CHECK-O0-NEXT: movzbl %cl, %esi
273 ; CHECK-O0-NEXT: movl %esi, var
274 ; CHECK-O0-NEXT: andb $1, %r8b
275 ; CHECK-O0-NEXT: movzbl %r8b, %esi
276 ; CHECK-O0-NEXT: movl %esi, var
277 ; CHECK-O0-NEXT: popq %rax
278 ; CHECK-O0-NEXT: .cfi_def_cfa_offset 8
279 ; CHECK-O0-NEXT: retq
280 %call = call swiftcc { i1, i1, i1, i1 } @produce_i1_ret()
281 %v3 = extractvalue { i1, i1, i1, i1 } %call, 0
282 %v5 = extractvalue { i1, i1, i1, i1 } %call, 1
283 %v6 = extractvalue { i1, i1, i1, i1 } %call, 2
284 %v7 = extractvalue { i1, i1, i1, i1 } %call, 3
285 %val = zext i1 %v3 to i32
286 store volatile i32 %val, i32* @var
287 %val2 = zext i1 %v5 to i32
288 store volatile i32 %val2, i32* @var
289 %val3 = zext i1 %v6 to i32
290 store volatile i32 %val3, i32* @var
291 %val4 = zext i1 %v7 to i32
292 store i32 %val4, i32* @var
296 declare swiftcc { i1, i1, i1, i1 } @produce_i1_ret()
298 define swiftcc void @foo(i64* sret %agg.result, i64 %val) {
301 ; CHECK-NEXT: movq %rdi, (%rax)
304 ; CHECK-O0-LABEL: foo:
306 ; CHECK-O0-NEXT: movq %rdi, (%rax)
307 ; CHECK-O0-NEXT: retq
308 store i64 %val, i64* %agg.result
312 define swiftcc double @test5() #0 {
313 ; CHECK-LABEL: test5:
314 ; CHECK: # %bb.0: # %entry
315 ; CHECK-NEXT: pushq %rax
316 ; CHECK-NEXT: .cfi_def_cfa_offset 16
317 ; CHECK-NEXT: callq gen5
318 ; CHECK-NEXT: addsd %xmm1, %xmm0
319 ; CHECK-NEXT: addsd %xmm2, %xmm0
320 ; CHECK-NEXT: addsd %xmm3, %xmm0
321 ; CHECK-NEXT: popq %rax
322 ; CHECK-NEXT: .cfi_def_cfa_offset 8
325 ; CHECK-O0-LABEL: test5:
326 ; CHECK-O0: # %bb.0: # %entry
327 ; CHECK-O0-NEXT: pushq %rax
328 ; CHECK-O0-NEXT: .cfi_def_cfa_offset 16
329 ; CHECK-O0-NEXT: callq gen5
330 ; CHECK-O0-NEXT: addsd %xmm1, %xmm0
331 ; CHECK-O0-NEXT: addsd %xmm2, %xmm0
332 ; CHECK-O0-NEXT: addsd %xmm3, %xmm0
333 ; CHECK-O0-NEXT: popq %rax
334 ; CHECK-O0-NEXT: .cfi_def_cfa_offset 8
335 ; CHECK-O0-NEXT: retq
337 %call = call swiftcc { double, double, double, double } @gen5()
339 %v3 = extractvalue { double, double, double, double } %call, 0
340 %v5 = extractvalue { double, double, double, double } %call, 1
341 %v6 = extractvalue { double, double, double, double } %call, 2
342 %v7 = extractvalue { double, double, double, double } %call, 3
344 %add = fadd double %v3, %v5
345 %add1 = fadd double %add, %v6
346 %add2 = fadd double %add1, %v7
350 declare swiftcc { double, double, double, double } @gen5()
353 define swiftcc { double, i64 } @test6() #0 {
354 ; CHECK-LABEL: test6:
355 ; CHECK: # %bb.0: # %entry
356 ; CHECK-NEXT: pushq %rax
357 ; CHECK-NEXT: .cfi_def_cfa_offset 16
358 ; CHECK-NEXT: callq gen6
359 ; CHECK-NEXT: addsd %xmm1, %xmm0
360 ; CHECK-NEXT: addsd %xmm2, %xmm0
361 ; CHECK-NEXT: addsd %xmm3, %xmm0
362 ; CHECK-NEXT: addq %rdx, %rax
363 ; CHECK-NEXT: addq %rcx, %rax
364 ; CHECK-NEXT: addq %r8, %rax
365 ; CHECK-NEXT: popq %rcx
366 ; CHECK-NEXT: .cfi_def_cfa_offset 8
369 ; CHECK-O0-LABEL: test6:
370 ; CHECK-O0: # %bb.0: # %entry
371 ; CHECK-O0-NEXT: pushq %rax
372 ; CHECK-O0-NEXT: .cfi_def_cfa_offset 16
373 ; CHECK-O0-NEXT: callq gen6
374 ; CHECK-O0-NEXT: addsd %xmm1, %xmm0
375 ; CHECK-O0-NEXT: addsd %xmm2, %xmm0
376 ; CHECK-O0-NEXT: addsd %xmm3, %xmm0
377 ; CHECK-O0-NEXT: addq %rdx, %rax
378 ; CHECK-O0-NEXT: addq %rcx, %rax
379 ; CHECK-O0-NEXT: addq %r8, %rax
380 ; CHECK-O0-NEXT: popq %rcx
381 ; CHECK-O0-NEXT: .cfi_def_cfa_offset 8
382 ; CHECK-O0-NEXT: retq
384 %call = call swiftcc { double, double, double, double, i64, i64, i64, i64 } @gen6()
386 %v3 = extractvalue { double, double, double, double, i64, i64, i64, i64 } %call, 0
387 %v5 = extractvalue { double, double, double, double, i64, i64, i64, i64 } %call, 1
388 %v6 = extractvalue { double, double, double, double, i64, i64, i64, i64 } %call, 2
389 %v7 = extractvalue { double, double, double, double, i64, i64, i64, i64 } %call, 3
390 %v3.i = extractvalue { double, double, double, double, i64, i64, i64, i64 } %call, 4
391 %v5.i = extractvalue { double, double, double, double, i64, i64, i64, i64 } %call, 5
392 %v6.i = extractvalue { double, double, double, double, i64, i64, i64, i64 } %call, 6
393 %v7.i = extractvalue { double, double, double, double, i64, i64, i64, i64 } %call, 7
395 %add = fadd double %v3, %v5
396 %add1 = fadd double %add, %v6
397 %add2 = fadd double %add1, %v7
399 %add.i = add nsw i64 %v3.i, %v5.i
400 %add1.i = add nsw i64 %add.i, %v6.i
401 %add2.i = add nsw i64 %add1.i, %v7.i
403 %Y = insertvalue { double, i64 } undef, double %add2, 0
404 %Z = insertvalue { double, i64 } %Y, i64 %add2.i, 1
405 ret { double, i64} %Z
408 declare swiftcc { double, double, double, double, i64, i64, i64, i64 } @gen6()
410 define swiftcc { i32, i32, i32, i32 } @gen7(i32 %key) {
413 ; CHECK-NEXT: movl %edi, %eax
414 ; CHECK-NEXT: movl %edi, %edx
415 ; CHECK-NEXT: movl %edi, %ecx
416 ; CHECK-NEXT: movl %edi, %r8d
419 ; CHECK-O0-LABEL: gen7:
421 ; CHECK-O0-NEXT: movl %edi, %eax
422 ; CHECK-O0-NEXT: movl %edi, %edx
423 ; CHECK-O0-NEXT: movl %edi, %ecx
424 ; CHECK-O0-NEXT: movl %edi, %r8d
425 ; CHECK-O0-NEXT: retq
426 %v0 = insertvalue { i32, i32, i32, i32 } undef, i32 %key, 0
427 %v1 = insertvalue { i32, i32, i32, i32 } %v0, i32 %key, 1
428 %v2 = insertvalue { i32, i32, i32, i32 } %v1, i32 %key, 2
429 %v3 = insertvalue { i32, i32, i32, i32 } %v2, i32 %key, 3
430 ret { i32, i32, i32, i32 } %v3
433 define swiftcc { i64, i64, i64, i64 } @gen8(i64 %key) {
436 ; CHECK-NEXT: movq %rdi, %rax
437 ; CHECK-NEXT: movq %rdi, %rdx
438 ; CHECK-NEXT: movq %rdi, %rcx
439 ; CHECK-NEXT: movq %rdi, %r8
442 ; CHECK-O0-LABEL: gen8:
444 ; CHECK-O0-NEXT: movq %rdi, %rax
445 ; CHECK-O0-NEXT: movq %rdi, %rdx
446 ; CHECK-O0-NEXT: movq %rdi, %rcx
447 ; CHECK-O0-NEXT: movq %rdi, %r8
448 ; CHECK-O0-NEXT: retq
449 %v0 = insertvalue { i64, i64, i64, i64 } undef, i64 %key, 0
450 %v1 = insertvalue { i64, i64, i64, i64 } %v0, i64 %key, 1
451 %v2 = insertvalue { i64, i64, i64, i64 } %v1, i64 %key, 2
452 %v3 = insertvalue { i64, i64, i64, i64 } %v2, i64 %key, 3
453 ret { i64, i64, i64, i64 } %v3
456 define swiftcc { i8, i8, i8, i8 } @gen9(i8 %key) {
459 ; CHECK-NEXT: movl %edi, %eax
460 ; CHECK-NEXT: movl %eax, %edx
461 ; CHECK-NEXT: movl %eax, %ecx
462 ; CHECK-NEXT: movl %eax, %r8d
465 ; CHECK-O0-LABEL: gen9:
467 ; CHECK-O0-NEXT: movb %dil, %al
468 ; CHECK-O0-NEXT: movb %al, {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Spill
469 ; CHECK-O0-NEXT: movb {{[-0-9]+}}(%r{{[sb]}}p), %dl # 1-byte Reload
470 ; CHECK-O0-NEXT: movb {{[-0-9]+}}(%r{{[sb]}}p), %cl # 1-byte Reload
471 ; CHECK-O0-NEXT: movb {{[-0-9]+}}(%r{{[sb]}}p), %r8b # 1-byte Reload
472 ; CHECK-O0-NEXT: retq
473 %v0 = insertvalue { i8, i8, i8, i8 } undef, i8 %key, 0
474 %v1 = insertvalue { i8, i8, i8, i8 } %v0, i8 %key, 1
475 %v2 = insertvalue { i8, i8, i8, i8 } %v1, i8 %key, 2
476 %v3 = insertvalue { i8, i8, i8, i8 } %v2, i8 %key, 3
477 ret { i8, i8, i8, i8 } %v3
479 define swiftcc { double, double, double, double, i64, i64, i64, i64 } @gen10(double %keyd, i64 %keyi) {
480 ; CHECK-LABEL: gen10:
482 ; CHECK-NEXT: movq %rdi, %rax
483 ; CHECK-NEXT: movaps %xmm0, %xmm1
484 ; CHECK-NEXT: movaps %xmm0, %xmm2
485 ; CHECK-NEXT: movaps %xmm0, %xmm3
486 ; CHECK-NEXT: movq %rdi, %rdx
487 ; CHECK-NEXT: movq %rdi, %rcx
488 ; CHECK-NEXT: movq %rdi, %r8
491 ; CHECK-O0-LABEL: gen10:
493 ; CHECK-O0-NEXT: movsd %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
494 ; CHECK-O0-NEXT: movsd {{[-0-9]+}}(%r{{[sb]}}p), %xmm1 # 8-byte Reload
495 ; CHECK-O0-NEXT: # xmm1 = mem[0],zero
496 ; CHECK-O0-NEXT: movsd {{[-0-9]+}}(%r{{[sb]}}p), %xmm2 # 8-byte Reload
497 ; CHECK-O0-NEXT: # xmm2 = mem[0],zero
498 ; CHECK-O0-NEXT: movsd {{[-0-9]+}}(%r{{[sb]}}p), %xmm3 # 8-byte Reload
499 ; CHECK-O0-NEXT: # xmm3 = mem[0],zero
500 ; CHECK-O0-NEXT: movq %rdi, %rax
501 ; CHECK-O0-NEXT: movq %rdi, %rdx
502 ; CHECK-O0-NEXT: movq %rdi, %rcx
503 ; CHECK-O0-NEXT: movq %rdi, %r8
504 ; CHECK-O0-NEXT: retq
505 %v0 = insertvalue { double, double, double, double, i64, i64, i64, i64 } undef, double %keyd, 0
506 %v1 = insertvalue { double, double, double, double, i64, i64, i64, i64 } %v0, double %keyd, 1
507 %v2 = insertvalue { double, double, double, double, i64, i64, i64, i64 } %v1, double %keyd, 2
508 %v3 = insertvalue { double, double, double, double, i64, i64, i64, i64 } %v2, double %keyd, 3
509 %v4 = insertvalue { double, double, double, double, i64, i64, i64, i64 } %v3, i64 %keyi, 4
510 %v5 = insertvalue { double, double, double, double, i64, i64, i64, i64 } %v4, i64 %keyi, 5
511 %v6 = insertvalue { double, double, double, double, i64, i64, i64, i64 } %v5, i64 %keyi, 6
512 %v7 = insertvalue { double, double, double, double, i64, i64, i64, i64 } %v6, i64 %keyi, 7
513 ret { double, double, double, double, i64, i64, i64, i64 } %v7
517 define swiftcc <4 x float> @test11() #0 {
518 ; CHECK-LABEL: test11:
519 ; CHECK: # %bb.0: # %entry
520 ; CHECK-NEXT: pushq %rax
521 ; CHECK-NEXT: .cfi_def_cfa_offset 16
522 ; CHECK-NEXT: callq gen11
523 ; CHECK-NEXT: addps %xmm1, %xmm0
524 ; CHECK-NEXT: addps %xmm2, %xmm0
525 ; CHECK-NEXT: addps %xmm3, %xmm0
526 ; CHECK-NEXT: popq %rax
527 ; CHECK-NEXT: .cfi_def_cfa_offset 8
530 ; CHECK-O0-LABEL: test11:
531 ; CHECK-O0: # %bb.0: # %entry
532 ; CHECK-O0-NEXT: pushq %rax
533 ; CHECK-O0-NEXT: .cfi_def_cfa_offset 16
534 ; CHECK-O0-NEXT: callq gen11
535 ; CHECK-O0-NEXT: addps %xmm1, %xmm0
536 ; CHECK-O0-NEXT: addps %xmm2, %xmm0
537 ; CHECK-O0-NEXT: addps %xmm3, %xmm0
538 ; CHECK-O0-NEXT: popq %rax
539 ; CHECK-O0-NEXT: .cfi_def_cfa_offset 8
540 ; CHECK-O0-NEXT: retq
542 %call = call swiftcc { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @gen11()
544 %v3 = extractvalue { <4 x float>, <4 x float>, <4 x float>, <4 x float> } %call, 0
545 %v5 = extractvalue { <4 x float>, <4 x float>, <4 x float>, <4 x float> } %call, 1
546 %v6 = extractvalue { <4 x float>, <4 x float>, <4 x float>, <4 x float> } %call, 2
547 %v7 = extractvalue { <4 x float>, <4 x float>, <4 x float>, <4 x float> } %call, 3
549 %add = fadd <4 x float> %v3, %v5
550 %add1 = fadd <4 x float> %add, %v6
551 %add2 = fadd <4 x float> %add1, %v7
552 ret <4 x float> %add2
555 declare swiftcc { <4 x float>, <4 x float>, <4 x float>, <4 x float> } @gen11()
557 define swiftcc { <4 x float>, float } @test12() #0 {
558 ; CHECK-LABEL: test12:
559 ; CHECK: # %bb.0: # %entry
560 ; CHECK-NEXT: pushq %rax
561 ; CHECK-NEXT: .cfi_def_cfa_offset 16
562 ; CHECK-NEXT: callq gen12
563 ; CHECK-NEXT: addps %xmm1, %xmm0
564 ; CHECK-NEXT: addps %xmm2, %xmm0
565 ; CHECK-NEXT: movaps %xmm3, %xmm1
566 ; CHECK-NEXT: popq %rax
567 ; CHECK-NEXT: .cfi_def_cfa_offset 8
570 ; CHECK-O0-LABEL: test12:
571 ; CHECK-O0: # %bb.0: # %entry
572 ; CHECK-O0-NEXT: pushq %rax
573 ; CHECK-O0-NEXT: .cfi_def_cfa_offset 16
574 ; CHECK-O0-NEXT: callq gen12
575 ; CHECK-O0-NEXT: addps %xmm1, %xmm0
576 ; CHECK-O0-NEXT: addps %xmm2, %xmm0
577 ; CHECK-O0-NEXT: movaps %xmm3, %xmm1
578 ; CHECK-O0-NEXT: popq %rax
579 ; CHECK-O0-NEXT: .cfi_def_cfa_offset 8
580 ; CHECK-O0-NEXT: retq
582 %call = call swiftcc { <4 x float>, <4 x float>, <4 x float>, float } @gen12()
584 %v3 = extractvalue { <4 x float>, <4 x float>, <4 x float>, float } %call, 0
585 %v5 = extractvalue { <4 x float>, <4 x float>, <4 x float>, float } %call, 1
586 %v6 = extractvalue { <4 x float>, <4 x float>, <4 x float>, float } %call, 2
587 %v8 = extractvalue { <4 x float>, <4 x float>, <4 x float>, float } %call, 3
589 %add = fadd <4 x float> %v3, %v5
590 %add1 = fadd <4 x float> %add, %v6
591 %res.0 = insertvalue { <4 x float>, float } undef, <4 x float> %add1, 0
592 %res = insertvalue { <4 x float>, float } %res.0, float %v8, 1
593 ret { <4 x float>, float } %res
596 declare swiftcc { <4 x float>, <4 x float>, <4 x float>, float } @gen12()