1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i386-pc-win32 -mattr=+avx512f -mattr=+avx512vl -mattr=+avx512bw -mattr=+avx512dq -verify-machineinstrs | FileCheck %s --check-prefix=X32
3 ; RUN: llc < %s -mtriple=x86_64-win32 -mattr=+avx512f -mattr=+avx512vl -mattr=+avx512bw -mattr=+avx512dq -verify-machineinstrs | FileCheck %s --check-prefix=WIN64
4 ; RUN: llc < %s -mtriple=x86_64-linux-gnu -mattr=+avx512f -mattr=+avx512vl -mattr=+avx512bw -mattr=+avx512dq -verify-machineinstrs | FileCheck %s --check-prefix=LINUXOSX64
6 ; Test regcall when receiving/returning i1
7 define dso_local x86_regcallcc i1 @test_argReti1(i1 %a) {
8 ; X32-LABEL: test_argReti1:
11 ; X32-NEXT: # kill: def $al killed $al killed $eax
14 ; WIN64-LABEL: test_argReti1:
16 ; WIN64-NEXT: incb %al
17 ; WIN64-NEXT: # kill: def $al killed $al killed $eax
20 ; LINUXOSX64-LABEL: test_argReti1:
21 ; LINUXOSX64: # %bb.0:
22 ; LINUXOSX64-NEXT: incb %al
23 ; LINUXOSX64-NEXT: # kill: def $al killed $al killed $eax
24 ; LINUXOSX64-NEXT: retq
29 ; Test regcall when passing/retrieving i1
30 define dso_local x86_regcallcc i1 @test_CallargReti1(i1 %a) {
31 ; X32-LABEL: test_CallargReti1:
34 ; X32-NEXT: movzbl %al, %eax
35 ; X32-NEXT: calll _test_argReti1
39 ; WIN64-LABEL: test_CallargReti1:
41 ; WIN64-NEXT: pushq %rax
42 ; WIN64-NEXT: .seh_stackalloc 8
43 ; WIN64-NEXT: .seh_endprologue
44 ; WIN64-NEXT: incb %al
45 ; WIN64-NEXT: movzbl %al, %eax
46 ; WIN64-NEXT: callq test_argReti1
47 ; WIN64-NEXT: incb %al
48 ; WIN64-NEXT: popq %rcx
50 ; WIN64-NEXT: .seh_endproc
52 ; LINUXOSX64-LABEL: test_CallargReti1:
53 ; LINUXOSX64: # %bb.0:
54 ; LINUXOSX64-NEXT: pushq %rax
55 ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 16
56 ; LINUXOSX64-NEXT: incb %al
57 ; LINUXOSX64-NEXT: movzbl %al, %eax
58 ; LINUXOSX64-NEXT: callq test_argReti1
59 ; LINUXOSX64-NEXT: incb %al
60 ; LINUXOSX64-NEXT: popq %rcx
61 ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 8
62 ; LINUXOSX64-NEXT: retq
64 %c = call x86_regcallcc i1 @test_argReti1(i1 %b)
69 ; Test regcall when receiving/returning i8
70 define dso_local x86_regcallcc i8 @test_argReti8(i8 %a) {
71 ; X32-LABEL: test_argReti8:
74 ; X32-NEXT: # kill: def $al killed $al killed $eax
77 ; WIN64-LABEL: test_argReti8:
79 ; WIN64-NEXT: incb %al
80 ; WIN64-NEXT: # kill: def $al killed $al killed $eax
83 ; LINUXOSX64-LABEL: test_argReti8:
84 ; LINUXOSX64: # %bb.0:
85 ; LINUXOSX64-NEXT: incb %al
86 ; LINUXOSX64-NEXT: # kill: def $al killed $al killed $eax
87 ; LINUXOSX64-NEXT: retq
92 ; Test regcall when passing/retrieving i8
93 define dso_local x86_regcallcc i8 @test_CallargReti8(i8 %a) {
94 ; X32-LABEL: test_CallargReti8:
97 ; X32-NEXT: movzbl %al, %eax
98 ; X32-NEXT: calll _test_argReti8
102 ; WIN64-LABEL: test_CallargReti8:
104 ; WIN64-NEXT: pushq %rax
105 ; WIN64-NEXT: .seh_stackalloc 8
106 ; WIN64-NEXT: .seh_endprologue
107 ; WIN64-NEXT: incb %al
108 ; WIN64-NEXT: movzbl %al, %eax
109 ; WIN64-NEXT: callq test_argReti8
110 ; WIN64-NEXT: incb %al
111 ; WIN64-NEXT: popq %rcx
113 ; WIN64-NEXT: .seh_endproc
115 ; LINUXOSX64-LABEL: test_CallargReti8:
116 ; LINUXOSX64: # %bb.0:
117 ; LINUXOSX64-NEXT: pushq %rax
118 ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 16
119 ; LINUXOSX64-NEXT: incb %al
120 ; LINUXOSX64-NEXT: movzbl %al, %eax
121 ; LINUXOSX64-NEXT: callq test_argReti8
122 ; LINUXOSX64-NEXT: incb %al
123 ; LINUXOSX64-NEXT: popq %rcx
124 ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 8
125 ; LINUXOSX64-NEXT: retq
127 %c = call x86_regcallcc i8 @test_argReti8(i8 %b)
132 ; Test regcall when receiving/returning i16
133 define dso_local x86_regcallcc i16 @test_argReti16(i16 %a) {
134 ; X32-LABEL: test_argReti16:
136 ; X32-NEXT: incl %eax
137 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
140 ; WIN64-LABEL: test_argReti16:
142 ; WIN64-NEXT: incl %eax
143 ; WIN64-NEXT: # kill: def $ax killed $ax killed $eax
146 ; LINUXOSX64-LABEL: test_argReti16:
147 ; LINUXOSX64: # %bb.0:
148 ; LINUXOSX64-NEXT: incl %eax
149 ; LINUXOSX64-NEXT: # kill: def $ax killed $ax killed $eax
150 ; LINUXOSX64-NEXT: retq
155 ; Test regcall when passing/retrieving i16
156 define dso_local x86_regcallcc i16 @test_CallargReti16(i16 %a) {
157 ; X32-LABEL: test_CallargReti16:
159 ; X32-NEXT: incl %eax
160 ; X32-NEXT: calll _test_argReti16
161 ; X32-NEXT: # kill: def $ax killed $ax def $eax
162 ; X32-NEXT: incl %eax
163 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
166 ; WIN64-LABEL: test_CallargReti16:
168 ; WIN64-NEXT: pushq %rax
169 ; WIN64-NEXT: .seh_stackalloc 8
170 ; WIN64-NEXT: .seh_endprologue
171 ; WIN64-NEXT: incl %eax
172 ; WIN64-NEXT: callq test_argReti16
173 ; WIN64-NEXT: # kill: def $ax killed $ax def $eax
174 ; WIN64-NEXT: incl %eax
175 ; WIN64-NEXT: # kill: def $ax killed $ax killed $eax
176 ; WIN64-NEXT: popq %rcx
178 ; WIN64-NEXT: .seh_endproc
180 ; LINUXOSX64-LABEL: test_CallargReti16:
181 ; LINUXOSX64: # %bb.0:
182 ; LINUXOSX64-NEXT: pushq %rax
183 ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 16
184 ; LINUXOSX64-NEXT: incl %eax
185 ; LINUXOSX64-NEXT: callq test_argReti16
186 ; LINUXOSX64-NEXT: # kill: def $ax killed $ax def $eax
187 ; LINUXOSX64-NEXT: incl %eax
188 ; LINUXOSX64-NEXT: # kill: def $ax killed $ax killed $eax
189 ; LINUXOSX64-NEXT: popq %rcx
190 ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 8
191 ; LINUXOSX64-NEXT: retq
193 %c = call x86_regcallcc i16 @test_argReti16(i16 %b)
198 ; Test regcall when receiving/returning i32
199 define dso_local x86_regcallcc i32 @test_argReti32(i32 %a) {
200 ; X32-LABEL: test_argReti32:
202 ; X32-NEXT: incl %eax
205 ; WIN64-LABEL: test_argReti32:
207 ; WIN64-NEXT: incl %eax
210 ; LINUXOSX64-LABEL: test_argReti32:
211 ; LINUXOSX64: # %bb.0:
212 ; LINUXOSX64-NEXT: incl %eax
213 ; LINUXOSX64-NEXT: retq
218 ; Test regcall when passing/retrieving i32
219 define dso_local x86_regcallcc i32 @test_CallargReti32(i32 %a) {
220 ; X32-LABEL: test_CallargReti32:
222 ; X32-NEXT: incl %eax
223 ; X32-NEXT: calll _test_argReti32
224 ; X32-NEXT: incl %eax
227 ; WIN64-LABEL: test_CallargReti32:
229 ; WIN64-NEXT: pushq %rax
230 ; WIN64-NEXT: .seh_stackalloc 8
231 ; WIN64-NEXT: .seh_endprologue
232 ; WIN64-NEXT: incl %eax
233 ; WIN64-NEXT: callq test_argReti32
234 ; WIN64-NEXT: incl %eax
235 ; WIN64-NEXT: popq %rcx
237 ; WIN64-NEXT: .seh_endproc
239 ; LINUXOSX64-LABEL: test_CallargReti32:
240 ; LINUXOSX64: # %bb.0:
241 ; LINUXOSX64-NEXT: pushq %rax
242 ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 16
243 ; LINUXOSX64-NEXT: incl %eax
244 ; LINUXOSX64-NEXT: callq test_argReti32
245 ; LINUXOSX64-NEXT: incl %eax
246 ; LINUXOSX64-NEXT: popq %rcx
247 ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 8
248 ; LINUXOSX64-NEXT: retq
250 %c = call x86_regcallcc i32 @test_argReti32(i32 %b)
255 ; Test regcall when receiving/returning i64
256 define dso_local x86_regcallcc i64 @test_argReti64(i64 %a) {
257 ; X32-LABEL: test_argReti64:
259 ; X32-NEXT: addl $3, %eax
260 ; X32-NEXT: adcl $1, %ecx
263 ; WIN64-LABEL: test_argReti64:
265 ; WIN64-NEXT: movabsq $4294967299, %rcx # imm = 0x100000003
266 ; WIN64-NEXT: addq %rcx, %rax
269 ; LINUXOSX64-LABEL: test_argReti64:
270 ; LINUXOSX64: # %bb.0:
271 ; LINUXOSX64-NEXT: movabsq $4294967299, %rcx # imm = 0x100000003
272 ; LINUXOSX64-NEXT: addq %rcx, %rax
273 ; LINUXOSX64-NEXT: retq
274 %add = add i64 %a, 4294967299
278 ; Test regcall when passing/retrieving i64
279 define dso_local x86_regcallcc i64 @test_CallargReti64(i64 %a) {
280 ; X32-LABEL: test_CallargReti64:
282 ; X32-NEXT: addl $1, %eax
283 ; X32-NEXT: adcl $0, %ecx
284 ; X32-NEXT: calll _test_argReti64
285 ; X32-NEXT: addl $1, %eax
286 ; X32-NEXT: adcl $0, %ecx
289 ; WIN64-LABEL: test_CallargReti64:
291 ; WIN64-NEXT: pushq %rax
292 ; WIN64-NEXT: .seh_stackalloc 8
293 ; WIN64-NEXT: .seh_endprologue
294 ; WIN64-NEXT: incq %rax
295 ; WIN64-NEXT: callq test_argReti64
296 ; WIN64-NEXT: incq %rax
297 ; WIN64-NEXT: popq %rcx
299 ; WIN64-NEXT: .seh_endproc
301 ; LINUXOSX64-LABEL: test_CallargReti64:
302 ; LINUXOSX64: # %bb.0:
303 ; LINUXOSX64-NEXT: pushq %rax
304 ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 16
305 ; LINUXOSX64-NEXT: incq %rax
306 ; LINUXOSX64-NEXT: callq test_argReti64
307 ; LINUXOSX64-NEXT: incq %rax
308 ; LINUXOSX64-NEXT: popq %rcx
309 ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 8
310 ; LINUXOSX64-NEXT: retq
312 %c = call x86_regcallcc i64 @test_argReti64(i64 %b)
317 ; Test regcall when receiving/returning float
318 define dso_local x86_regcallcc float @test_argRetFloat(float %a) {
319 ; X32-LABEL: test_argRetFloat:
321 ; X32-NEXT: vaddss __real@3f800000, %xmm0, %xmm0
324 ; WIN64-LABEL: test_argRetFloat:
326 ; WIN64-NEXT: vaddss __real@3f800000(%rip), %xmm0, %xmm0
329 ; LINUXOSX64-LABEL: test_argRetFloat:
330 ; LINUXOSX64: # %bb.0:
331 ; LINUXOSX64-NEXT: vaddss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
332 ; LINUXOSX64-NEXT: retq
333 %add = fadd float 1.0, %a
337 ; Test regcall when passing/retrieving float
338 define dso_local x86_regcallcc float @test_CallargRetFloat(float %a) {
339 ; X32-LABEL: test_CallargRetFloat:
341 ; X32-NEXT: subl $28, %esp
342 ; X32-NEXT: vmovups %xmm4, (%esp) # 16-byte Spill
343 ; X32-NEXT: vmovss {{.*#+}} xmm4 = [1.0E+0,0.0E+0,0.0E+0,0.0E+0]
344 ; X32-NEXT: vaddss %xmm4, %xmm0, %xmm0
345 ; X32-NEXT: calll _test_argRetFloat
346 ; X32-NEXT: vaddss %xmm4, %xmm0, %xmm0
347 ; X32-NEXT: vmovups (%esp), %xmm4 # 16-byte Reload
348 ; X32-NEXT: addl $28, %esp
351 ; WIN64-LABEL: test_CallargRetFloat:
353 ; WIN64-NEXT: subq $24, %rsp
354 ; WIN64-NEXT: .seh_stackalloc 24
355 ; WIN64-NEXT: vmovaps %xmm8, (%rsp) # 16-byte Spill
356 ; WIN64-NEXT: .seh_savexmm %xmm8, 0
357 ; WIN64-NEXT: .seh_endprologue
358 ; WIN64-NEXT: vmovss {{.*#+}} xmm8 = [1.0E+0,0.0E+0,0.0E+0,0.0E+0]
359 ; WIN64-NEXT: vaddss %xmm0, %xmm8, %xmm0
360 ; WIN64-NEXT: callq test_argRetFloat
361 ; WIN64-NEXT: vaddss %xmm0, %xmm8, %xmm0
362 ; WIN64-NEXT: vmovaps (%rsp), %xmm8 # 16-byte Reload
363 ; WIN64-NEXT: addq $24, %rsp
365 ; WIN64-NEXT: .seh_endproc
367 ; LINUXOSX64-LABEL: test_CallargRetFloat:
368 ; LINUXOSX64: # %bb.0:
369 ; LINUXOSX64-NEXT: subq $24, %rsp
370 ; LINUXOSX64-NEXT: vmovaps %xmm8, (%rsp) # 16-byte Spill
371 ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 32
372 ; LINUXOSX64-NEXT: .cfi_offset %xmm8, -32
373 ; LINUXOSX64-NEXT: vmovss {{.*#+}} xmm8 = [1.0E+0,0.0E+0,0.0E+0,0.0E+0]
374 ; LINUXOSX64-NEXT: vaddss %xmm0, %xmm8, %xmm0
375 ; LINUXOSX64-NEXT: callq test_argRetFloat
376 ; LINUXOSX64-NEXT: vaddss %xmm0, %xmm8, %xmm0
377 ; LINUXOSX64-NEXT: vmovaps (%rsp), %xmm8 # 16-byte Reload
378 ; LINUXOSX64-NEXT: addq $24, %rsp
379 ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 8
380 ; LINUXOSX64-NEXT: retq
381 %b = fadd float 1.0, %a
382 %c = call x86_regcallcc float @test_argRetFloat(float %b)
383 %d = fadd float 1.0, %c
387 ; Test regcall when receiving/returning double
388 define dso_local x86_regcallcc double @test_argRetDouble(double %a) {
389 ; X32-LABEL: test_argRetDouble:
391 ; X32-NEXT: vaddsd __real@3ff0000000000000, %xmm0, %xmm0
394 ; WIN64-LABEL: test_argRetDouble:
396 ; WIN64-NEXT: vaddsd __real@3ff0000000000000(%rip), %xmm0, %xmm0
399 ; LINUXOSX64-LABEL: test_argRetDouble:
400 ; LINUXOSX64: # %bb.0:
401 ; LINUXOSX64-NEXT: vaddsd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
402 ; LINUXOSX64-NEXT: retq
403 %add = fadd double %a, 1.0
407 ; Test regcall when passing/retrieving double
408 define dso_local x86_regcallcc double @test_CallargRetDouble(double %a) {
409 ; X32-LABEL: test_CallargRetDouble:
411 ; X32-NEXT: subl $28, %esp
412 ; X32-NEXT: vmovups %xmm4, (%esp) # 16-byte Spill
413 ; X32-NEXT: vmovsd {{.*#+}} xmm4 = [1.0E+0,0.0E+0]
414 ; X32-NEXT: vaddsd %xmm4, %xmm0, %xmm0
415 ; X32-NEXT: calll _test_argRetDouble
416 ; X32-NEXT: vaddsd %xmm4, %xmm0, %xmm0
417 ; X32-NEXT: vmovups (%esp), %xmm4 # 16-byte Reload
418 ; X32-NEXT: addl $28, %esp
421 ; WIN64-LABEL: test_CallargRetDouble:
423 ; WIN64-NEXT: subq $24, %rsp
424 ; WIN64-NEXT: .seh_stackalloc 24
425 ; WIN64-NEXT: vmovaps %xmm8, (%rsp) # 16-byte Spill
426 ; WIN64-NEXT: .seh_savexmm %xmm8, 0
427 ; WIN64-NEXT: .seh_endprologue
428 ; WIN64-NEXT: vmovsd {{.*#+}} xmm8 = [1.0E+0,0.0E+0]
429 ; WIN64-NEXT: vaddsd %xmm0, %xmm8, %xmm0
430 ; WIN64-NEXT: callq test_argRetDouble
431 ; WIN64-NEXT: vaddsd %xmm0, %xmm8, %xmm0
432 ; WIN64-NEXT: vmovaps (%rsp), %xmm8 # 16-byte Reload
433 ; WIN64-NEXT: addq $24, %rsp
435 ; WIN64-NEXT: .seh_endproc
437 ; LINUXOSX64-LABEL: test_CallargRetDouble:
438 ; LINUXOSX64: # %bb.0:
439 ; LINUXOSX64-NEXT: subq $24, %rsp
440 ; LINUXOSX64-NEXT: vmovaps %xmm8, (%rsp) # 16-byte Spill
441 ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 32
442 ; LINUXOSX64-NEXT: .cfi_offset %xmm8, -32
443 ; LINUXOSX64-NEXT: vmovsd {{.*#+}} xmm8 = [1.0E+0,0.0E+0]
444 ; LINUXOSX64-NEXT: vaddsd %xmm0, %xmm8, %xmm0
445 ; LINUXOSX64-NEXT: callq test_argRetDouble
446 ; LINUXOSX64-NEXT: vaddsd %xmm0, %xmm8, %xmm0
447 ; LINUXOSX64-NEXT: vmovaps (%rsp), %xmm8 # 16-byte Reload
448 ; LINUXOSX64-NEXT: addq $24, %rsp
449 ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 8
450 ; LINUXOSX64-NEXT: retq
451 %b = fadd double 1.0, %a
452 %c = call x86_regcallcc double @test_argRetDouble(double %b)
453 %d = fadd double 1.0, %c
457 ; Test regcall when receiving/returning long double
458 define dso_local x86_regcallcc x86_fp80 @test_argRetf80(x86_fp80 %a0) nounwind {
459 ; X32-LABEL: test_argRetf80:
461 ; X32-NEXT: fadd %st, %st(0)
464 ; WIN64-LABEL: test_argRetf80:
466 ; WIN64-NEXT: fadd %st, %st(0)
469 ; LINUXOSX64-LABEL: test_argRetf80:
470 ; LINUXOSX64: # %bb.0:
471 ; LINUXOSX64-NEXT: fadd %st, %st(0)
472 ; LINUXOSX64-NEXT: retq
473 %r0 = fadd x86_fp80 %a0, %a0
477 ; Test regcall when receiving/returning long double
478 define dso_local x86_regcallcc double @test_argParamf80(x86_fp80 %a0) nounwind {
479 ; X32-LABEL: test_argParamf80:
481 ; X32-NEXT: pushl %ebp
482 ; X32-NEXT: movl %esp, %ebp
483 ; X32-NEXT: andl $-8, %esp
484 ; X32-NEXT: subl $8, %esp
485 ; X32-NEXT: fstpl (%esp)
486 ; X32-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
487 ; X32-NEXT: movl %ebp, %esp
488 ; X32-NEXT: popl %ebp
491 ; WIN64-LABEL: test_argParamf80:
493 ; WIN64-NEXT: pushq %rax
494 ; WIN64-NEXT: fstpl (%rsp)
495 ; WIN64-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
496 ; WIN64-NEXT: popq %rax
499 ; LINUXOSX64-LABEL: test_argParamf80:
500 ; LINUXOSX64: # %bb.0:
501 ; LINUXOSX64-NEXT: fstpl -{{[0-9]+}}(%rsp)
502 ; LINUXOSX64-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
503 ; LINUXOSX64-NEXT: retq
504 %r0 = fptrunc x86_fp80 %a0 to double
508 ; Test regcall when passing/retrieving long double
509 define x86_regcallcc x86_fp80 @test_CallargRetf80(x86_fp80 %a) {
510 ; X32-LABEL: test_CallargRetf80:
512 ; X32-NEXT: fadd %st, %st(0)
513 ; X32-NEXT: calll _test_argRetf80
514 ; X32-NEXT: fadd %st, %st(0)
517 ; WIN64-LABEL: test_CallargRetf80:
519 ; WIN64-NEXT: pushq %rax
520 ; WIN64-NEXT: .seh_stackalloc 8
521 ; WIN64-NEXT: .seh_endprologue
522 ; WIN64-NEXT: fadd %st, %st(0)
523 ; WIN64-NEXT: callq test_argRetf80
524 ; WIN64-NEXT: fadd %st, %st(0)
525 ; WIN64-NEXT: popq %rax
527 ; WIN64-NEXT: .seh_endproc
529 ; LINUXOSX64-LABEL: test_CallargRetf80:
530 ; LINUXOSX64: # %bb.0:
531 ; LINUXOSX64-NEXT: pushq %rax
532 ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 16
533 ; LINUXOSX64-NEXT: fadd %st, %st(0)
534 ; LINUXOSX64-NEXT: callq test_argRetf80
535 ; LINUXOSX64-NEXT: fadd %st, %st(0)
536 ; LINUXOSX64-NEXT: popq %rax
537 ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 8
538 ; LINUXOSX64-NEXT: retq
539 %b = fadd x86_fp80 %a, %a
540 %c = call x86_regcallcc x86_fp80 @test_argRetf80(x86_fp80 %b)
541 %d = fadd x86_fp80 %c, %c
545 define dso_local x86_regcallcc double @test_CallargParamf80(x86_fp80 %a) {
546 ; X32-LABEL: test_CallargParamf80:
548 ; X32-NEXT: fadd %st, %st(0)
549 ; X32-NEXT: calll _test_argParamf80
550 ; X32-NEXT: vaddsd %xmm0, %xmm0, %xmm0
553 ; WIN64-LABEL: test_CallargParamf80:
555 ; WIN64-NEXT: pushq %rax
556 ; WIN64-NEXT: .seh_stackalloc 8
557 ; WIN64-NEXT: .seh_endprologue
558 ; WIN64-NEXT: fadd %st, %st(0)
559 ; WIN64-NEXT: callq test_argParamf80
560 ; WIN64-NEXT: vaddsd %xmm0, %xmm0, %xmm0
561 ; WIN64-NEXT: popq %rax
563 ; WIN64-NEXT: .seh_endproc
565 ; LINUXOSX64-LABEL: test_CallargParamf80:
566 ; LINUXOSX64: # %bb.0:
567 ; LINUXOSX64-NEXT: pushq %rax
568 ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 16
569 ; LINUXOSX64-NEXT: fadd %st, %st(0)
570 ; LINUXOSX64-NEXT: callq test_argParamf80
571 ; LINUXOSX64-NEXT: vaddsd %xmm0, %xmm0, %xmm0
572 ; LINUXOSX64-NEXT: popq %rax
573 ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 8
574 ; LINUXOSX64-NEXT: retq
575 %b = fadd x86_fp80 %a, %a
576 %c = call x86_regcallcc double @test_argParamf80(x86_fp80 %b)
577 %d = fadd double %c, %c
581 ; Test regcall when receiving/returning pointer
582 define dso_local x86_regcallcc ptr @test_argRetPointer(ptr %a) {
583 ; X32-LABEL: test_argRetPointer:
585 ; X32-NEXT: incl %eax
588 ; WIN64-LABEL: test_argRetPointer:
590 ; WIN64-NEXT: incl %eax
593 ; LINUXOSX64-LABEL: test_argRetPointer:
594 ; LINUXOSX64: # %bb.0:
595 ; LINUXOSX64-NEXT: incl %eax
596 ; LINUXOSX64-NEXT: retq
597 %b = ptrtoint ptr %a to i32
599 %d = inttoptr i32 %c to ptr
603 ; Test regcall when passing/retrieving pointer
604 define dso_local x86_regcallcc ptr @test_CallargRetPointer(ptr %a) {
605 ; X32-LABEL: test_CallargRetPointer:
607 ; X32-NEXT: incl %eax
608 ; X32-NEXT: calll _test_argRetPointer
609 ; X32-NEXT: incl %eax
612 ; WIN64-LABEL: test_CallargRetPointer:
614 ; WIN64-NEXT: pushq %rax
615 ; WIN64-NEXT: .seh_stackalloc 8
616 ; WIN64-NEXT: .seh_endprologue
617 ; WIN64-NEXT: incl %eax
618 ; WIN64-NEXT: callq test_argRetPointer
619 ; WIN64-NEXT: incl %eax
620 ; WIN64-NEXT: popq %rcx
622 ; WIN64-NEXT: .seh_endproc
624 ; LINUXOSX64-LABEL: test_CallargRetPointer:
625 ; LINUXOSX64: # %bb.0:
626 ; LINUXOSX64-NEXT: pushq %rax
627 ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 16
628 ; LINUXOSX64-NEXT: incl %eax
629 ; LINUXOSX64-NEXT: callq test_argRetPointer
630 ; LINUXOSX64-NEXT: incl %eax
631 ; LINUXOSX64-NEXT: popq %rcx
632 ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 8
633 ; LINUXOSX64-NEXT: retq
634 %b = ptrtoint ptr %a to i32
636 %d = inttoptr i32 %c to ptr
637 %e = call x86_regcallcc ptr @test_argRetPointer(ptr %d)
638 %f = ptrtoint ptr %e to i32
640 %h = inttoptr i32 %g to ptr
644 ; Test regcall when receiving/returning 128 bit vector
645 define dso_local x86_regcallcc <4 x i32> @test_argRet128Vector(<4 x i1> %x, <4 x i32> %a, <4 x i32> %b) {
646 ; X32-LABEL: test_argRet128Vector:
648 ; X32-NEXT: vpslld $31, %xmm0, %xmm0
649 ; X32-NEXT: vpmovd2m %xmm0, %k1
650 ; X32-NEXT: vpblendmd %xmm1, %xmm2, %xmm0 {%k1}
653 ; WIN64-LABEL: test_argRet128Vector:
655 ; WIN64-NEXT: vpslld $31, %xmm0, %xmm0
656 ; WIN64-NEXT: vpmovd2m %xmm0, %k1
657 ; WIN64-NEXT: vpblendmd %xmm1, %xmm2, %xmm0 {%k1}
660 ; LINUXOSX64-LABEL: test_argRet128Vector:
661 ; LINUXOSX64: # %bb.0:
662 ; LINUXOSX64-NEXT: vpslld $31, %xmm0, %xmm0
663 ; LINUXOSX64-NEXT: vpmovd2m %xmm0, %k1
664 ; LINUXOSX64-NEXT: vpblendmd %xmm1, %xmm2, %xmm0 {%k1}
665 ; LINUXOSX64-NEXT: retq
666 %d = select <4 x i1> %x, <4 x i32> %a, <4 x i32> %b
670 ; Test regcall when passing/retrieving 128 bit vector
671 define dso_local x86_regcallcc <4 x i32> @test_CallargRet128Vector(<4 x i1> %x, <4 x i32> %a) {
672 ; X32-LABEL: test_CallargRet128Vector:
674 ; X32-NEXT: subl $44, %esp
675 ; X32-NEXT: vmovups %xmm4, {{[-0-9]+}}(%e{{[sb]}}p) # 16-byte Spill
676 ; X32-NEXT: vmovdqa %xmm1, %xmm4
677 ; X32-NEXT: vpslld $31, %xmm0, %xmm1
678 ; X32-NEXT: vpmovd2m %xmm1, %k1
679 ; X32-NEXT: kmovw %k1, {{[-0-9]+}}(%e{{[sb]}}p) # 2-byte Spill
680 ; X32-NEXT: vmovdqa %xmm4, %xmm1
681 ; X32-NEXT: vmovdqa %xmm4, %xmm2
682 ; X32-NEXT: calll _test_argRet128Vector
683 ; X32-NEXT: kmovw {{[-0-9]+}}(%e{{[sb]}}p), %k1 # 2-byte Reload
684 ; X32-NEXT: vmovdqa32 %xmm4, %xmm0 {%k1}
685 ; X32-NEXT: vmovups {{[-0-9]+}}(%e{{[sb]}}p), %xmm4 # 16-byte Reload
686 ; X32-NEXT: addl $44, %esp
689 ; WIN64-LABEL: test_CallargRet128Vector:
691 ; WIN64-NEXT: subq $40, %rsp
692 ; WIN64-NEXT: .seh_stackalloc 40
693 ; WIN64-NEXT: vmovaps %xmm8, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
694 ; WIN64-NEXT: .seh_savexmm %xmm8, 16
695 ; WIN64-NEXT: .seh_endprologue
696 ; WIN64-NEXT: vmovdqa %xmm1, %xmm8
697 ; WIN64-NEXT: vpslld $31, %xmm0, %xmm1
698 ; WIN64-NEXT: vpmovd2m %xmm1, %k1
699 ; WIN64-NEXT: kmovw %k1, {{[-0-9]+}}(%r{{[sb]}}p) # 2-byte Spill
700 ; WIN64-NEXT: vmovdqa %xmm8, %xmm1
701 ; WIN64-NEXT: vmovdqa %xmm8, %xmm2
702 ; WIN64-NEXT: callq test_argRet128Vector
703 ; WIN64-NEXT: kmovw {{[-0-9]+}}(%r{{[sb]}}p), %k1 # 2-byte Reload
704 ; WIN64-NEXT: vmovdqa32 %xmm8, %xmm0 {%k1}
705 ; WIN64-NEXT: vmovaps {{[-0-9]+}}(%r{{[sb]}}p), %xmm8 # 16-byte Reload
706 ; WIN64-NEXT: addq $40, %rsp
708 ; WIN64-NEXT: .seh_endproc
710 ; LINUXOSX64-LABEL: test_CallargRet128Vector:
711 ; LINUXOSX64: # %bb.0:
712 ; LINUXOSX64-NEXT: subq $40, %rsp
713 ; LINUXOSX64-NEXT: vmovaps %xmm8, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
714 ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 48
715 ; LINUXOSX64-NEXT: .cfi_offset %xmm8, -32
716 ; LINUXOSX64-NEXT: vmovdqa %xmm1, %xmm8
717 ; LINUXOSX64-NEXT: vpslld $31, %xmm0, %xmm1
718 ; LINUXOSX64-NEXT: vpmovd2m %xmm1, %k1
719 ; LINUXOSX64-NEXT: kmovw %k1, {{[-0-9]+}}(%r{{[sb]}}p) # 2-byte Spill
720 ; LINUXOSX64-NEXT: vmovdqa %xmm8, %xmm1
721 ; LINUXOSX64-NEXT: vmovdqa %xmm8, %xmm2
722 ; LINUXOSX64-NEXT: callq test_argRet128Vector
723 ; LINUXOSX64-NEXT: kmovw {{[-0-9]+}}(%r{{[sb]}}p), %k1 # 2-byte Reload
724 ; LINUXOSX64-NEXT: vmovdqa32 %xmm8, %xmm0 {%k1}
725 ; LINUXOSX64-NEXT: vmovaps {{[-0-9]+}}(%r{{[sb]}}p), %xmm8 # 16-byte Reload
726 ; LINUXOSX64-NEXT: addq $40, %rsp
727 ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 8
728 ; LINUXOSX64-NEXT: retq
729 %b = call x86_regcallcc <4 x i32> @test_argRet128Vector(<4 x i1> %x, <4 x i32> %a, <4 x i32> %a)
730 %c = select <4 x i1> %x, <4 x i32> %a, <4 x i32> %b
734 ; Test regcall when receiving/returning 256 bit vector
735 define dso_local x86_regcallcc <8 x i32> @test_argRet256Vector(<8 x i1> %x, <8 x i32> %a, <8 x i32> %b) {
736 ; X32-LABEL: test_argRet256Vector:
738 ; X32-NEXT: kmovd %eax, %k1
739 ; X32-NEXT: vpblendmd %ymm0, %ymm1, %ymm0 {%k1}
742 ; WIN64-LABEL: test_argRet256Vector:
744 ; WIN64-NEXT: kmovd %eax, %k1
745 ; WIN64-NEXT: vpblendmd %ymm0, %ymm1, %ymm0 {%k1}
748 ; LINUXOSX64-LABEL: test_argRet256Vector:
749 ; LINUXOSX64: # %bb.0:
750 ; LINUXOSX64-NEXT: kmovd %eax, %k1
751 ; LINUXOSX64-NEXT: vpblendmd %ymm0, %ymm1, %ymm0 {%k1}
752 ; LINUXOSX64-NEXT: retq
753 %d = select <8 x i1> %x, <8 x i32> %a, <8 x i32> %b
757 ; Test regcall when passing/retrieving 256 bit vector
758 define dso_local x86_regcallcc <8 x i32> @test_CallargRet256Vector(<8 x i1> %x, <8 x i32> %a) {
759 ; X32-LABEL: test_CallargRet256Vector:
761 ; X32-NEXT: subl $36, %esp
762 ; X32-NEXT: vmovdqu %ymm0, {{[-0-9]+}}(%e{{[sb]}}p) # 32-byte Spill
763 ; X32-NEXT: kmovd %eax, %k1
764 ; X32-NEXT: kmovw %k1, {{[-0-9]+}}(%e{{[sb]}}p) # 2-byte Spill
765 ; X32-NEXT: vmovdqa %ymm0, %ymm1
766 ; X32-NEXT: calll _test_argRet256Vector
767 ; X32-NEXT: kmovw {{[-0-9]+}}(%e{{[sb]}}p), %k1 # 2-byte Reload
768 ; X32-NEXT: vmovdqu {{[-0-9]+}}(%e{{[sb]}}p), %ymm1 # 32-byte Reload
769 ; X32-NEXT: vmovdqa32 %ymm1, %ymm0 {%k1}
770 ; X32-NEXT: addl $36, %esp
773 ; WIN64-LABEL: test_CallargRet256Vector:
775 ; WIN64-NEXT: subq $56, %rsp
776 ; WIN64-NEXT: .seh_stackalloc 56
777 ; WIN64-NEXT: .seh_endprologue
778 ; WIN64-NEXT: vmovdqu %ymm0, {{[-0-9]+}}(%r{{[sb]}}p) # 32-byte Spill
779 ; WIN64-NEXT: kmovd %eax, %k1
780 ; WIN64-NEXT: kmovw %k1, {{[-0-9]+}}(%r{{[sb]}}p) # 2-byte Spill
781 ; WIN64-NEXT: vmovdqa %ymm0, %ymm1
782 ; WIN64-NEXT: callq test_argRet256Vector
783 ; WIN64-NEXT: kmovw {{[-0-9]+}}(%r{{[sb]}}p), %k1 # 2-byte Reload
784 ; WIN64-NEXT: vmovdqu {{[-0-9]+}}(%r{{[sb]}}p), %ymm1 # 32-byte Reload
785 ; WIN64-NEXT: vmovdqa32 %ymm1, %ymm0 {%k1}
786 ; WIN64-NEXT: addq $56, %rsp
788 ; WIN64-NEXT: .seh_endproc
790 ; LINUXOSX64-LABEL: test_CallargRet256Vector:
791 ; LINUXOSX64: # %bb.0:
792 ; LINUXOSX64-NEXT: subq $56, %rsp
793 ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 64
794 ; LINUXOSX64-NEXT: vmovdqu %ymm0, {{[-0-9]+}}(%r{{[sb]}}p) # 32-byte Spill
795 ; LINUXOSX64-NEXT: kmovd %eax, %k1
796 ; LINUXOSX64-NEXT: kmovw %k1, {{[-0-9]+}}(%r{{[sb]}}p) # 2-byte Spill
797 ; LINUXOSX64-NEXT: vmovdqa %ymm0, %ymm1
798 ; LINUXOSX64-NEXT: callq test_argRet256Vector
799 ; LINUXOSX64-NEXT: kmovw {{[-0-9]+}}(%r{{[sb]}}p), %k1 # 2-byte Reload
800 ; LINUXOSX64-NEXT: vmovdqu {{[-0-9]+}}(%r{{[sb]}}p), %ymm1 # 32-byte Reload
801 ; LINUXOSX64-NEXT: vmovdqa32 %ymm1, %ymm0 {%k1}
802 ; LINUXOSX64-NEXT: addq $56, %rsp
803 ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 8
804 ; LINUXOSX64-NEXT: retq
805 %b = call x86_regcallcc <8 x i32> @test_argRet256Vector(<8 x i1> %x, <8 x i32> %a, <8 x i32> %a)
806 %c = select <8 x i1> %x, <8 x i32> %a, <8 x i32> %b
810 ; Test regcall when receiving/returning 512 bit vector
811 define dso_local x86_regcallcc <16 x i32> @test_argRet512Vector(<16 x i1> %x, <16 x i32> %a, <16 x i32> %b) {
812 ; X32-LABEL: test_argRet512Vector:
814 ; X32-NEXT: kmovd %eax, %k1
815 ; X32-NEXT: vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
818 ; WIN64-LABEL: test_argRet512Vector:
820 ; WIN64-NEXT: kmovd %eax, %k1
821 ; WIN64-NEXT: vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
824 ; LINUXOSX64-LABEL: test_argRet512Vector:
825 ; LINUXOSX64: # %bb.0:
826 ; LINUXOSX64-NEXT: kmovd %eax, %k1
827 ; LINUXOSX64-NEXT: vpblendmd %zmm0, %zmm1, %zmm0 {%k1}
828 ; LINUXOSX64-NEXT: retq
829 %d = select <16 x i1> %x, <16 x i32> %a, <16 x i32> %b
833 ; Test regcall when passing/retrieving 512 bit vector
834 define dso_local x86_regcallcc <16 x i32> @test_CallargRet512Vector(<16 x i1> %x, <16 x i32> %a) {
835 ; X32-LABEL: test_CallargRet512Vector:
837 ; X32-NEXT: subl $68, %esp
838 ; X32-NEXT: vmovdqu64 %zmm0, {{[-0-9]+}}(%e{{[sb]}}p) # 64-byte Spill
839 ; X32-NEXT: kmovd %eax, %k1
840 ; X32-NEXT: kmovw %k1, {{[-0-9]+}}(%e{{[sb]}}p) # 2-byte Spill
841 ; X32-NEXT: vmovdqa64 %zmm0, %zmm1
842 ; X32-NEXT: calll _test_argRet512Vector
843 ; X32-NEXT: kmovw {{[-0-9]+}}(%e{{[sb]}}p), %k1 # 2-byte Reload
844 ; X32-NEXT: vmovdqu64 {{[-0-9]+}}(%e{{[sb]}}p), %zmm1 # 64-byte Reload
845 ; X32-NEXT: vmovdqa32 %zmm1, %zmm0 {%k1}
846 ; X32-NEXT: addl $68, %esp
849 ; WIN64-LABEL: test_CallargRet512Vector:
851 ; WIN64-NEXT: subq $88, %rsp
852 ; WIN64-NEXT: .seh_stackalloc 88
853 ; WIN64-NEXT: .seh_endprologue
854 ; WIN64-NEXT: vmovdqu64 %zmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 64-byte Spill
855 ; WIN64-NEXT: kmovd %eax, %k1
856 ; WIN64-NEXT: kmovw %k1, {{[-0-9]+}}(%r{{[sb]}}p) # 2-byte Spill
857 ; WIN64-NEXT: vmovdqa64 %zmm0, %zmm1
858 ; WIN64-NEXT: callq test_argRet512Vector
859 ; WIN64-NEXT: kmovw {{[-0-9]+}}(%r{{[sb]}}p), %k1 # 2-byte Reload
860 ; WIN64-NEXT: vmovdqu64 {{[-0-9]+}}(%r{{[sb]}}p), %zmm1 # 64-byte Reload
861 ; WIN64-NEXT: vmovdqa32 %zmm1, %zmm0 {%k1}
862 ; WIN64-NEXT: addq $88, %rsp
864 ; WIN64-NEXT: .seh_endproc
866 ; LINUXOSX64-LABEL: test_CallargRet512Vector:
867 ; LINUXOSX64: # %bb.0:
868 ; LINUXOSX64-NEXT: subq $88, %rsp
869 ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 96
870 ; LINUXOSX64-NEXT: vmovdqu64 %zmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 64-byte Spill
871 ; LINUXOSX64-NEXT: kmovd %eax, %k1
872 ; LINUXOSX64-NEXT: kmovw %k1, {{[-0-9]+}}(%r{{[sb]}}p) # 2-byte Spill
873 ; LINUXOSX64-NEXT: vmovdqa64 %zmm0, %zmm1
874 ; LINUXOSX64-NEXT: callq test_argRet512Vector
875 ; LINUXOSX64-NEXT: kmovw {{[-0-9]+}}(%r{{[sb]}}p), %k1 # 2-byte Reload
876 ; LINUXOSX64-NEXT: vmovdqu64 {{[-0-9]+}}(%r{{[sb]}}p), %zmm1 # 64-byte Reload
877 ; LINUXOSX64-NEXT: vmovdqa32 %zmm1, %zmm0 {%k1}
878 ; LINUXOSX64-NEXT: addq $88, %rsp
879 ; LINUXOSX64-NEXT: .cfi_def_cfa_offset 8
880 ; LINUXOSX64-NEXT: retq
881 %b = call x86_regcallcc <16 x i32> @test_argRet512Vector(<16 x i1> %x, <16 x i32> %a, <16 x i32> %a)
882 %c = select <16 x i1> %x, <16 x i32> %a, <16 x i32> %b
886 ; Test regcall when running multiple input parameters - callee saved xmms
887 define dso_local x86_regcallcc <32 x float> @testf32_inp(<32 x float> %a, <32 x float> %b, <32 x float> %c) nounwind {
888 ; X32-LABEL: testf32_inp:
890 ; X32-NEXT: subl $44, %esp
891 ; X32-NEXT: vmovups %xmm7, {{[-0-9]+}}(%e{{[sb]}}p) # 16-byte Spill
892 ; X32-NEXT: vmovups %xmm6, (%esp) # 16-byte Spill
893 ; X32-NEXT: vaddps %zmm2, %zmm0, %zmm6
894 ; X32-NEXT: vaddps %zmm3, %zmm1, %zmm7
895 ; X32-NEXT: vmulps %zmm2, %zmm0, %zmm0
896 ; X32-NEXT: vsubps %zmm0, %zmm6, %zmm0
897 ; X32-NEXT: vmulps %zmm3, %zmm1, %zmm1
898 ; X32-NEXT: vsubps %zmm1, %zmm7, %zmm1
899 ; X32-NEXT: vaddps %zmm4, %zmm0, %zmm0
900 ; X32-NEXT: vaddps %zmm5, %zmm1, %zmm1
901 ; X32-NEXT: vmovups (%esp), %xmm6 # 16-byte Reload
902 ; X32-NEXT: vmovups {{[-0-9]+}}(%e{{[sb]}}p), %xmm7 # 16-byte Reload
903 ; X32-NEXT: addl $44, %esp
906 ; WIN64-LABEL: testf32_inp:
908 ; WIN64-NEXT: vaddps %zmm2, %zmm0, %zmm6
909 ; WIN64-NEXT: vaddps %zmm3, %zmm1, %zmm7
910 ; WIN64-NEXT: vmulps %zmm2, %zmm0, %zmm0
911 ; WIN64-NEXT: vsubps %zmm0, %zmm6, %zmm0
912 ; WIN64-NEXT: vmulps %zmm3, %zmm1, %zmm1
913 ; WIN64-NEXT: vsubps %zmm1, %zmm7, %zmm1
914 ; WIN64-NEXT: vaddps %zmm4, %zmm0, %zmm0
915 ; WIN64-NEXT: vaddps %zmm5, %zmm1, %zmm1
918 ; LINUXOSX64-LABEL: testf32_inp:
919 ; LINUXOSX64: # %bb.0:
920 ; LINUXOSX64-NEXT: vaddps %zmm2, %zmm0, %zmm6
921 ; LINUXOSX64-NEXT: vaddps %zmm3, %zmm1, %zmm7
922 ; LINUXOSX64-NEXT: vmulps %zmm2, %zmm0, %zmm0
923 ; LINUXOSX64-NEXT: vsubps %zmm0, %zmm6, %zmm0
924 ; LINUXOSX64-NEXT: vmulps %zmm3, %zmm1, %zmm1
925 ; LINUXOSX64-NEXT: vsubps %zmm1, %zmm7, %zmm1
926 ; LINUXOSX64-NEXT: vaddps %zmm4, %zmm0, %zmm0
927 ; LINUXOSX64-NEXT: vaddps %zmm5, %zmm1, %zmm1
928 ; LINUXOSX64-NEXT: retq
929 %x1 = fadd <32 x float> %a, %b
930 %x2 = fmul <32 x float> %a, %b
931 %x3 = fsub <32 x float> %x1, %x2
932 %x4 = fadd <32 x float> %x3, %c
936 ; Test regcall when running multiple input parameters - callee saved GPRs
937 define dso_local x86_regcallcc i32 @testi32_inp(i32 %a1, i32 %a2, i32 %a3, i32 %a4, i32 %a5, i32 %a6, i32 %b1, i32 %b2, i32 %b3, i32 %b4, i32 %b5, i32 %b6) nounwind {
938 ; X32-LABEL: testi32_inp:
940 ; X32-NEXT: pushl %ebp
941 ; X32-NEXT: pushl %ebx
942 ; X32-NEXT: subl $12, %esp
943 ; X32-NEXT: movl %esi, (%esp) # 4-byte Spill
944 ; X32-NEXT: movl %ecx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
945 ; X32-NEXT: movl %eax, %ebp
946 ; X32-NEXT: leal (%edx,%edi), %eax
947 ; X32-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
948 ; X32-NEXT: movl %edx, %eax
949 ; X32-NEXT: subl %edi, %eax
950 ; X32-NEXT: movl %ebp, %edx
951 ; X32-NEXT: subl %ecx, %edx
952 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ebx
953 ; X32-NEXT: subl {{[0-9]+}}(%esp), %ebx
954 ; X32-NEXT: imull %edx, %ebx
955 ; X32-NEXT: movl {{[0-9]+}}(%esp), %esi
956 ; X32-NEXT: movl %esi, %edx
957 ; X32-NEXT: subl {{[0-9]+}}(%esp), %edx
958 ; X32-NEXT: imull %eax, %edx
959 ; X32-NEXT: addl %ebx, %edx
960 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ebx
961 ; X32-NEXT: movl (%esp), %edi # 4-byte Reload
962 ; X32-NEXT: subl %ebx, %edi
963 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
964 ; X32-NEXT: movl %ecx, %eax
965 ; X32-NEXT: subl {{[0-9]+}}(%esp), %eax
966 ; X32-NEXT: imull %edi, %eax
967 ; X32-NEXT: addl %edx, %eax
968 ; X32-NEXT: addl {{[-0-9]+}}(%e{{[sb]}}p), %ebp # 4-byte Folded Reload
969 ; X32-NEXT: addl (%esp), %ebx # 4-byte Folded Reload
970 ; X32-NEXT: movl {{[0-9]+}}(%esp), %edx
971 ; X32-NEXT: addl {{[0-9]+}}(%esp), %edx
972 ; X32-NEXT: imull %edx, %ebp
973 ; X32-NEXT: addl {{[0-9]+}}(%esp), %esi
974 ; X32-NEXT: imull {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Folded Reload
975 ; X32-NEXT: addl %esi, %ebp
976 ; X32-NEXT: addl {{[0-9]+}}(%esp), %ecx
977 ; X32-NEXT: imull %ebx, %ecx
978 ; X32-NEXT: addl %ecx, %ebp
979 ; X32-NEXT: addl %eax, %ebp
980 ; X32-NEXT: movl %ebp, %eax
981 ; X32-NEXT: addl $12, %esp
982 ; X32-NEXT: popl %ebx
983 ; X32-NEXT: popl %ebp
986 ; WIN64-LABEL: testi32_inp:
988 ; WIN64-NEXT: pushq %rbp
989 ; WIN64-NEXT: pushq %rbx
990 ; WIN64-NEXT: # kill: def $edx killed $edx def $rdx
991 ; WIN64-NEXT: # kill: def $esi killed $esi def $rsi
992 ; WIN64-NEXT: # kill: def $r15d killed $r15d def $r15
993 ; WIN64-NEXT: # kill: def $r14d killed $r14d def $r14
994 ; WIN64-NEXT: # kill: def $r12d killed $r12d def $r12
995 ; WIN64-NEXT: # kill: def $r11d killed $r11d def $r11
996 ; WIN64-NEXT: # kill: def $r10d killed $r10d def $r10
997 ; WIN64-NEXT: # kill: def $r9d killed $r9d def $r9
998 ; WIN64-NEXT: # kill: def $r8d killed $r8d def $r8
999 ; WIN64-NEXT: # kill: def $edi killed $edi def $rdi
1000 ; WIN64-NEXT: leal (%rdx,%rdi), %ebx
1001 ; WIN64-NEXT: movl %edx, %ebp
1002 ; WIN64-NEXT: subl %edi, %ebp
1003 ; WIN64-NEXT: leal (%rsi,%r8), %edx
1004 ; WIN64-NEXT: # kill: def $esi killed $esi killed $rsi
1005 ; WIN64-NEXT: subl %r8d, %esi
1006 ; WIN64-NEXT: leal (%r9,%r10), %edi
1007 ; WIN64-NEXT: movl %r9d, %r8d
1008 ; WIN64-NEXT: subl %r10d, %r8d
1009 ; WIN64-NEXT: movl %eax, %r9d
1010 ; WIN64-NEXT: subl %ecx, %r9d
1011 ; WIN64-NEXT: imull %r9d, %r8d
1012 ; WIN64-NEXT: leal (%r11,%r12), %r9d
1013 ; WIN64-NEXT: movl %r11d, %r10d
1014 ; WIN64-NEXT: subl %r12d, %r10d
1015 ; WIN64-NEXT: imull %ebp, %r10d
1016 ; WIN64-NEXT: addl %r8d, %r10d
1017 ; WIN64-NEXT: leal (%r14,%r15), %r8d
1018 ; WIN64-NEXT: movl %r14d, %r11d
1019 ; WIN64-NEXT: subl %r15d, %r11d
1020 ; WIN64-NEXT: imull %esi, %r11d
1021 ; WIN64-NEXT: addl %r10d, %r11d
1022 ; WIN64-NEXT: addl %ecx, %eax
1023 ; WIN64-NEXT: imull %edi, %eax
1024 ; WIN64-NEXT: imull %ebx, %r9d
1025 ; WIN64-NEXT: addl %r9d, %eax
1026 ; WIN64-NEXT: imull %edx, %r8d
1027 ; WIN64-NEXT: addl %r8d, %eax
1028 ; WIN64-NEXT: addl %r11d, %eax
1029 ; WIN64-NEXT: popq %rbx
1030 ; WIN64-NEXT: popq %rbp
1033 ; LINUXOSX64-LABEL: testi32_inp:
1034 ; LINUXOSX64: # %bb.0:
1035 ; LINUXOSX64-NEXT: # kill: def $edx killed $edx def $rdx
1036 ; LINUXOSX64-NEXT: # kill: def $esi killed $esi def $rsi
1037 ; LINUXOSX64-NEXT: # kill: def $r14d killed $r14d def $r14
1038 ; LINUXOSX64-NEXT: # kill: def $r13d killed $r13d def $r13
1039 ; LINUXOSX64-NEXT: # kill: def $r12d killed $r12d def $r12
1040 ; LINUXOSX64-NEXT: # kill: def $r9d killed $r9d def $r9
1041 ; LINUXOSX64-NEXT: # kill: def $r8d killed $r8d def $r8
1042 ; LINUXOSX64-NEXT: # kill: def $edi killed $edi def $rdi
1043 ; LINUXOSX64-NEXT: leal (%rdx,%rdi), %r10d
1044 ; LINUXOSX64-NEXT: movl %edx, %r11d
1045 ; LINUXOSX64-NEXT: subl %edi, %r11d
1046 ; LINUXOSX64-NEXT: leal (%rsi,%r8), %edx
1047 ; LINUXOSX64-NEXT: # kill: def $esi killed $esi killed $rsi
1048 ; LINUXOSX64-NEXT: subl %r8d, %esi
1049 ; LINUXOSX64-NEXT: leal (%r9,%r12), %edi
1050 ; LINUXOSX64-NEXT: movl %r9d, %r8d
1051 ; LINUXOSX64-NEXT: subl %r12d, %r8d
1052 ; LINUXOSX64-NEXT: movl %eax, %r9d
1053 ; LINUXOSX64-NEXT: subl %ecx, %r9d
1054 ; LINUXOSX64-NEXT: imull %r9d, %r8d
1055 ; LINUXOSX64-NEXT: leal (%r13,%r14), %r9d
1056 ; LINUXOSX64-NEXT: movl %r13d, %r12d
1057 ; LINUXOSX64-NEXT: subl %r14d, %r12d
1058 ; LINUXOSX64-NEXT: imull %r11d, %r12d
1059 ; LINUXOSX64-NEXT: movl {{[0-9]+}}(%rsp), %r11d
1060 ; LINUXOSX64-NEXT: addl %r8d, %r12d
1061 ; LINUXOSX64-NEXT: movl %r15d, %r8d
1062 ; LINUXOSX64-NEXT: subl %r11d, %r8d
1063 ; LINUXOSX64-NEXT: imull %esi, %r8d
1064 ; LINUXOSX64-NEXT: addl %r12d, %r8d
1065 ; LINUXOSX64-NEXT: addl %ecx, %eax
1066 ; LINUXOSX64-NEXT: imull %edi, %eax
1067 ; LINUXOSX64-NEXT: imull %r10d, %r9d
1068 ; LINUXOSX64-NEXT: addl %r9d, %eax
1069 ; LINUXOSX64-NEXT: addl %r15d, %r11d
1070 ; LINUXOSX64-NEXT: imull %edx, %r11d
1071 ; LINUXOSX64-NEXT: addl %r11d, %eax
1072 ; LINUXOSX64-NEXT: addl %r8d, %eax
1073 ; LINUXOSX64-NEXT: retq
1074 %x1 = sub i32 %a1, %a2
1075 %x2 = sub i32 %a3, %a4
1076 %x3 = sub i32 %a5, %a6
1077 %y1 = sub i32 %b1, %b2
1078 %y2 = sub i32 %b3, %b4
1079 %y3 = sub i32 %b5, %b6
1080 %v1 = add i32 %a1, %a2
1081 %v2 = add i32 %a3, %a4
1082 %v3 = add i32 %a5, %a6
1083 %w1 = add i32 %b1, %b2
1084 %w2 = add i32 %b3, %b4
1085 %w3 = add i32 %b5, %b6
1086 %s1 = mul i32 %x1, %y1
1087 %s2 = mul i32 %x2, %y2
1088 %s3 = mul i32 %x3, %y3
1089 %t1 = mul i32 %v1, %w1
1090 %t2 = mul i32 %v2, %w2
1091 %t3 = mul i32 %v3, %w3
1092 %m1 = add i32 %s1, %s2
1093 %m2 = add i32 %m1, %s3
1094 %n1 = add i32 %t1, %t2
1095 %n2 = add i32 %n1, %t3
1096 %r1 = add i32 %m2, %n2
1100 ; Test that parameters, overflowing register capacity, are passed through the stack
1101 define dso_local x86_regcallcc <32 x float> @testf32_stack(<32 x float> %a0, <32 x float> %b0, <32 x float> %c0, <32 x float> %a1, <32 x float> %b1, <32 x float> %c1, <32 x float> %a2, <32 x float> %b2, <32 x float> %c2) nounwind {
1102 ; X32-LABEL: testf32_stack:
1104 ; X32-NEXT: pushl %ebp
1105 ; X32-NEXT: movl %esp, %ebp
1106 ; X32-NEXT: andl $-64, %esp
1107 ; X32-NEXT: subl $64, %esp
1108 ; X32-NEXT: vaddps %zmm3, %zmm1, %zmm1
1109 ; X32-NEXT: vaddps %zmm2, %zmm0, %zmm0
1110 ; X32-NEXT: vaddps %zmm0, %zmm4, %zmm0
1111 ; X32-NEXT: vaddps %zmm1, %zmm5, %zmm1
1112 ; X32-NEXT: vaddps %zmm1, %zmm7, %zmm1
1113 ; X32-NEXT: vaddps %zmm0, %zmm6, %zmm0
1114 ; X32-NEXT: vaddps 8(%ebp), %zmm0, %zmm0
1115 ; X32-NEXT: vaddps 72(%ebp), %zmm1, %zmm1
1116 ; X32-NEXT: vaddps 200(%ebp), %zmm1, %zmm1
1117 ; X32-NEXT: vaddps 136(%ebp), %zmm0, %zmm0
1118 ; X32-NEXT: vaddps 264(%ebp), %zmm0, %zmm0
1119 ; X32-NEXT: vaddps 328(%ebp), %zmm1, %zmm1
1120 ; X32-NEXT: vaddps 456(%ebp), %zmm1, %zmm1
1121 ; X32-NEXT: vaddps 392(%ebp), %zmm0, %zmm0
1122 ; X32-NEXT: vaddps 520(%ebp), %zmm0, %zmm0
1123 ; X32-NEXT: vaddps 584(%ebp), %zmm1, %zmm1
1124 ; X32-NEXT: movl %ebp, %esp
1125 ; X32-NEXT: popl %ebp
1128 ; WIN64-LABEL: testf32_stack:
1130 ; WIN64-NEXT: pushq %rbp
1131 ; WIN64-NEXT: subq $48, %rsp
1132 ; WIN64-NEXT: leaq {{[0-9]+}}(%rsp), %rbp
1133 ; WIN64-NEXT: andq $-64, %rsp
1134 ; WIN64-NEXT: vaddps %zmm3, %zmm1, %zmm1
1135 ; WIN64-NEXT: vaddps %zmm2, %zmm0, %zmm0
1136 ; WIN64-NEXT: vaddps %zmm0, %zmm4, %zmm0
1137 ; WIN64-NEXT: vaddps %zmm1, %zmm5, %zmm1
1138 ; WIN64-NEXT: vaddps %zmm1, %zmm7, %zmm1
1139 ; WIN64-NEXT: vaddps %zmm0, %zmm6, %zmm0
1140 ; WIN64-NEXT: vaddps %zmm0, %zmm8, %zmm0
1141 ; WIN64-NEXT: vaddps %zmm1, %zmm9, %zmm1
1142 ; WIN64-NEXT: vaddps %zmm1, %zmm11, %zmm1
1143 ; WIN64-NEXT: vaddps %zmm0, %zmm10, %zmm0
1144 ; WIN64-NEXT: vaddps %zmm0, %zmm12, %zmm0
1145 ; WIN64-NEXT: vaddps %zmm1, %zmm13, %zmm1
1146 ; WIN64-NEXT: vaddps %zmm1, %zmm15, %zmm1
1147 ; WIN64-NEXT: vaddps %zmm0, %zmm14, %zmm0
1148 ; WIN64-NEXT: vaddps 16(%rbp), %zmm0, %zmm0
1149 ; WIN64-NEXT: vaddps 80(%rbp), %zmm1, %zmm1
1150 ; WIN64-NEXT: movq %rbp, %rsp
1151 ; WIN64-NEXT: popq %rbp
1154 ; LINUXOSX64-LABEL: testf32_stack:
1155 ; LINUXOSX64: # %bb.0:
1156 ; LINUXOSX64-NEXT: pushq %rbp
1157 ; LINUXOSX64-NEXT: movq %rsp, %rbp
1158 ; LINUXOSX64-NEXT: andq $-64, %rsp
1159 ; LINUXOSX64-NEXT: subq $64, %rsp
1160 ; LINUXOSX64-NEXT: vaddps %zmm3, %zmm1, %zmm1
1161 ; LINUXOSX64-NEXT: vaddps %zmm2, %zmm0, %zmm0
1162 ; LINUXOSX64-NEXT: vaddps %zmm0, %zmm4, %zmm0
1163 ; LINUXOSX64-NEXT: vaddps %zmm1, %zmm5, %zmm1
1164 ; LINUXOSX64-NEXT: vaddps %zmm1, %zmm7, %zmm1
1165 ; LINUXOSX64-NEXT: vaddps %zmm0, %zmm6, %zmm0
1166 ; LINUXOSX64-NEXT: vaddps %zmm0, %zmm8, %zmm0
1167 ; LINUXOSX64-NEXT: vaddps %zmm1, %zmm9, %zmm1
1168 ; LINUXOSX64-NEXT: vaddps %zmm1, %zmm11, %zmm1
1169 ; LINUXOSX64-NEXT: vaddps %zmm0, %zmm10, %zmm0
1170 ; LINUXOSX64-NEXT: vaddps %zmm0, %zmm12, %zmm0
1171 ; LINUXOSX64-NEXT: vaddps %zmm1, %zmm13, %zmm1
1172 ; LINUXOSX64-NEXT: vaddps %zmm1, %zmm15, %zmm1
1173 ; LINUXOSX64-NEXT: vaddps %zmm0, %zmm14, %zmm0
1174 ; LINUXOSX64-NEXT: vaddps 16(%rbp), %zmm0, %zmm0
1175 ; LINUXOSX64-NEXT: vaddps 80(%rbp), %zmm1, %zmm1
1176 ; LINUXOSX64-NEXT: movq %rbp, %rsp
1177 ; LINUXOSX64-NEXT: popq %rbp
1178 ; LINUXOSX64-NEXT: retq
1179 %x1 = fadd <32 x float> %a0, %b0
1180 %x2 = fadd <32 x float> %c0, %x1
1181 %x3 = fadd <32 x float> %a1, %x2
1182 %x4 = fadd <32 x float> %b1, %x3
1183 %x5 = fadd <32 x float> %c1, %x4
1184 %x6 = fadd <32 x float> %a2, %x5
1185 %x7 = fadd <32 x float> %b2, %x6
1186 %x8 = fadd <32 x float> %c2, %x7
1187 ret <32 x float> %x8
1190 ; Test regcall when passing/retrieving mixed types
1191 define dso_local x86_regcallcc i32 @test_argRetMixTypes(double, float, i8 signext, i32, i64, i16 signext, ptr) #0 {
1192 ; X32-LABEL: test_argRetMixTypes:
1194 ; X32-NEXT: pushl %ebx
1195 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ebx
1196 ; X32-NEXT: vcvtss2sd %xmm1, %xmm1, %xmm1
1197 ; X32-NEXT: vaddsd %xmm0, %xmm1, %xmm0
1198 ; X32-NEXT: vcvtsi2sd %eax, %xmm2, %xmm1
1199 ; X32-NEXT: vaddsd %xmm1, %xmm0, %xmm0
1200 ; X32-NEXT: vcvtsi2sd %ecx, %xmm2, %xmm1
1201 ; X32-NEXT: vaddsd %xmm1, %xmm0, %xmm0
1202 ; X32-NEXT: vmovd %edx, %xmm1
1203 ; X32-NEXT: vpinsrd $1, %edi, %xmm1, %xmm1
1204 ; X32-NEXT: vcvtqq2pd %ymm1, %ymm1
1205 ; X32-NEXT: vaddsd %xmm1, %xmm0, %xmm0
1206 ; X32-NEXT: vcvtsi2sd %esi, %xmm2, %xmm1
1207 ; X32-NEXT: vaddsd %xmm1, %xmm0, %xmm0
1208 ; X32-NEXT: vcvtsi2sdl (%ebx), %xmm2, %xmm1
1209 ; X32-NEXT: vaddsd %xmm1, %xmm0, %xmm0
1210 ; X32-NEXT: vcvttsd2si %xmm0, %eax
1211 ; X32-NEXT: popl %ebx
1212 ; X32-NEXT: vzeroupper
1215 ; WIN64-LABEL: test_argRetMixTypes:
1217 ; WIN64-NEXT: vcvtss2sd %xmm1, %xmm1, %xmm1
1218 ; WIN64-NEXT: vaddsd %xmm0, %xmm1, %xmm0
1219 ; WIN64-NEXT: vcvtsi2sd %eax, %xmm2, %xmm1
1220 ; WIN64-NEXT: vaddsd %xmm1, %xmm0, %xmm0
1221 ; WIN64-NEXT: vcvtsi2sd %ecx, %xmm2, %xmm1
1222 ; WIN64-NEXT: vaddsd %xmm1, %xmm0, %xmm0
1223 ; WIN64-NEXT: vcvtsi2sd %rdx, %xmm2, %xmm1
1224 ; WIN64-NEXT: vaddsd %xmm1, %xmm0, %xmm0
1225 ; WIN64-NEXT: vcvtsi2sd %edi, %xmm2, %xmm1
1226 ; WIN64-NEXT: vaddsd %xmm1, %xmm0, %xmm0
1227 ; WIN64-NEXT: vcvtsi2sdl (%rsi), %xmm2, %xmm1
1228 ; WIN64-NEXT: vaddsd %xmm1, %xmm0, %xmm0
1229 ; WIN64-NEXT: vcvttsd2si %xmm0, %eax
1232 ; LINUXOSX64-LABEL: test_argRetMixTypes:
1233 ; LINUXOSX64: # %bb.0:
1234 ; LINUXOSX64-NEXT: vcvtss2sd %xmm1, %xmm1, %xmm1
1235 ; LINUXOSX64-NEXT: vaddsd %xmm0, %xmm1, %xmm0
1236 ; LINUXOSX64-NEXT: vcvtsi2sd %eax, %xmm2, %xmm1
1237 ; LINUXOSX64-NEXT: vaddsd %xmm1, %xmm0, %xmm0
1238 ; LINUXOSX64-NEXT: vcvtsi2sd %ecx, %xmm2, %xmm1
1239 ; LINUXOSX64-NEXT: vaddsd %xmm1, %xmm0, %xmm0
1240 ; LINUXOSX64-NEXT: vcvtsi2sd %rdx, %xmm2, %xmm1
1241 ; LINUXOSX64-NEXT: vaddsd %xmm1, %xmm0, %xmm0
1242 ; LINUXOSX64-NEXT: vcvtsi2sd %edi, %xmm2, %xmm1
1243 ; LINUXOSX64-NEXT: vaddsd %xmm1, %xmm0, %xmm0
1244 ; LINUXOSX64-NEXT: vcvtsi2sdl (%rsi), %xmm2, %xmm1
1245 ; LINUXOSX64-NEXT: vaddsd %xmm1, %xmm0, %xmm0
1246 ; LINUXOSX64-NEXT: vcvttsd2si %xmm0, %eax
1247 ; LINUXOSX64-NEXT: retq
1248 %8 = fpext float %1 to double
1249 %9 = fadd double %8, %0
1250 %10 = sitofp i8 %2 to double
1251 %11 = fadd double %9, %10
1252 %12 = sitofp i32 %3 to double
1253 %13 = fadd double %11, %12
1254 %14 = sitofp i64 %4 to double
1255 %15 = fadd double %13, %14
1256 %16 = sitofp i16 %5 to double
1257 %17 = fadd double %15, %16
1258 %18 = load i32, ptr %6, align 4
1259 %19 = sitofp i32 %18 to double
1260 %20 = fadd double %17, %19
1261 %21 = fptosi double %20 to i32
1265 %struct.complex = type { float, double, i32, i8, i64}
1267 define x86_regcallcc %struct.complex @test_argMultiRet(float, double, i32, i8, i64) local_unnamed_addr #0 {
1268 ; X32-LABEL: test_argMultiRet:
1270 ; X32-NEXT: vaddsd __real@4014000000000000, %xmm1, %xmm1
1271 ; X32-NEXT: movl $4, %eax
1272 ; X32-NEXT: movb $7, %cl
1273 ; X32-NEXT: movl $999, %edx # imm = 0x3E7
1274 ; X32-NEXT: xorl %edi, %edi
1277 ; WIN64-LABEL: test_argMultiRet:
1279 ; WIN64-NEXT: vaddsd __real@4014000000000000(%rip), %xmm1, %xmm1
1280 ; WIN64-NEXT: movl $999, %edx # imm = 0x3E7
1281 ; WIN64-NEXT: movl $4, %eax
1282 ; WIN64-NEXT: movb $7, %cl
1285 ; LINUXOSX64-LABEL: test_argMultiRet:
1286 ; LINUXOSX64: # %bb.0:
1287 ; LINUXOSX64-NEXT: vaddsd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1, %xmm1
1288 ; LINUXOSX64-NEXT: movl $999, %edx # imm = 0x3E7
1289 ; LINUXOSX64-NEXT: movl $4, %eax
1290 ; LINUXOSX64-NEXT: movb $7, %cl
1291 ; LINUXOSX64-NEXT: retq
1292 %6 = fadd double %1, 5.000000e+00
1293 %7 = insertvalue %struct.complex undef, float %0, 0
1294 %8 = insertvalue %struct.complex %7, double %6, 1
1295 %9 = insertvalue %struct.complex %8, i32 4, 2
1296 %10 = insertvalue %struct.complex %9, i8 7, 3
1297 %11 = insertvalue %struct.complex %10, i64 999, 4
1298 ret %struct.complex %11