1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple x86_64-w64-mingw32 %s -o - | FileCheck %s
4 declare void @foo(ptr byval({ float, double }))
5 @G = external constant { float, double }
8 ; Make sure we're creating a temporary stack slot, rather than just passing
9 ; the pointer through unmodified.
12 ; CHECK-NEXT: subq $56, %rsp
13 ; CHECK-NEXT: .seh_stackalloc 56
14 ; CHECK-NEXT: .seh_endprologue
15 ; CHECK-NEXT: movq .refptr.G(%rip), %rax
16 ; CHECK-NEXT: movq (%rax), %rcx
17 ; CHECK-NEXT: movq 8(%rax), %rax
18 ; CHECK-NEXT: movq %rax, {{[0-9]+}}(%rsp)
19 ; CHECK-NEXT: movq %rcx, {{[0-9]+}}(%rsp)
20 ; CHECK-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
21 ; CHECK-NEXT: callq foo
23 ; CHECK-NEXT: addq $56, %rsp
25 ; CHECK-NEXT: .seh_endproc
26 call void @foo(ptr byval({ float, double }) @G)
30 define void @baz(ptr byval({ float, double }) %arg) {
31 ; On Win64 the byval is effectively ignored on declarations, since we do
32 ; pass a real pointer in registers. However, by our semantics if we pass
33 ; the pointer on to another byval function, we do need to make a copy.
36 ; CHECK-NEXT: subq $56, %rsp
37 ; CHECK-NEXT: .seh_stackalloc 56
38 ; CHECK-NEXT: .seh_endprologue
39 ; CHECK-NEXT: movq (%rcx), %rax
40 ; CHECK-NEXT: movq 8(%rcx), %rcx
41 ; CHECK-NEXT: movq %rcx, {{[0-9]+}}(%rsp)
42 ; CHECK-NEXT: movq %rax, {{[0-9]+}}(%rsp)
43 ; CHECK-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
44 ; CHECK-NEXT: callq foo
46 ; CHECK-NEXT: addq $56, %rsp
48 ; CHECK-NEXT: .seh_endproc
49 call void @foo(ptr byval({ float, double }) %arg)
53 declare void @foo2(ptr byval({ float, double }), ptr byval({ float, double }), ptr byval({ float, double }), ptr byval({ float, double }), ptr byval({ float, double }), i64 %f)
54 @data = external constant { float, double }
59 ; CHECK-NEXT: subq $136, %rsp
60 ; CHECK-NEXT: .seh_stackalloc 136
61 ; CHECK-NEXT: .seh_endprologue
62 ; CHECK-NEXT: movq .refptr.G(%rip), %rax
63 ; CHECK-NEXT: movq (%rax), %rcx
64 ; CHECK-NEXT: movq 8(%rax), %rax
65 ; CHECK-NEXT: movq %rax, {{[0-9]+}}(%rsp)
66 ; CHECK-NEXT: movq %rcx, {{[0-9]+}}(%rsp)
67 ; CHECK-NEXT: movq %rcx, {{[0-9]+}}(%rsp)
68 ; CHECK-NEXT: movq %rax, {{[0-9]+}}(%rsp)
69 ; CHECK-NEXT: movq %rcx, {{[0-9]+}}(%rsp)
70 ; CHECK-NEXT: movq %rax, {{[0-9]+}}(%rsp)
71 ; CHECK-NEXT: movq %rcx, {{[0-9]+}}(%rsp)
72 ; CHECK-NEXT: movq %rax, {{[0-9]+}}(%rsp)
73 ; CHECK-NEXT: movq %rax, {{[0-9]+}}(%rsp)
74 ; CHECK-NEXT: movq %rcx, {{[0-9]+}}(%rsp)
75 ; CHECK-NEXT: leaq {{[0-9]+}}(%rsp), %rax
76 ; CHECK-NEXT: movq %rax, {{[0-9]+}}(%rsp)
77 ; CHECK-NEXT: movq $10, {{[0-9]+}}(%rsp)
78 ; CHECK-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
79 ; CHECK-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
80 ; CHECK-NEXT: leaq {{[0-9]+}}(%rsp), %r8
81 ; CHECK-NEXT: leaq {{[0-9]+}}(%rsp), %r9
82 ; CHECK-NEXT: callq foo2
84 ; CHECK-NEXT: addq $136, %rsp
86 ; CHECK-NEXT: .seh_endproc
87 call void @foo2(ptr byval({ float, double }) @G, ptr byval({ float, double }) @G, ptr byval({ float, double }) @G, ptr byval({ float, double }) @G, ptr byval({ float, double }) @G, i64 10)
91 define i64 @receive_byval_arg_via_stack_arg(ptr byval(i64), ptr byval(i64), ptr byval(i64), ptr byval(i64), ptr byval(i64) %x) {
92 ; CHECK-LABEL: receive_byval_arg_via_stack_arg:
94 ; CHECK-NEXT: movq {{[0-9]+}}(%rsp), %rax
95 ; CHECK-NEXT: movq (%rax), %rax