1 ; RUN: llc -mtriple x86_64-w64-mingw32 %s -o - | FileCheck %s
3 declare void @foo({ float, double }* byval({ float, double }))
4 @G = external constant { float, double }
8 ; Make sure we're creating a temporary stack slot, rather than just passing
9 ; the pointer through unmodified.
11 ; CHECK: movq .refptr.G(%rip), %rax
12 ; CHECK: movq (%rax), %rcx
13 ; CHECK: movq 8(%rax), %rax
14 ; CHECK: movq %rax, 40(%rsp)
15 ; CHECK: movq %rcx, 32(%rsp)
16 ; CHECK: leaq 32(%rsp), %rcx
17 call void @foo({ float, double }* byval({ float, double }) @G)
21 define void @baz({ float, double }* byval({ float, double }) %arg)
23 ; On Win64 the byval is effectively ignored on declarations, since we do
24 ; pass a real pointer in registers. However, by our semantics if we pass
25 ; the pointer on to another byval function, we do need to make a copy.
27 ; CHECK: movq (%rcx), %rax
28 ; CHECK: movq 8(%rcx), %rcx
29 ; CHECK: movq %rcx, 40(%rsp)
30 ; CHECK: movq %rax, 32(%rsp)
31 ; CHECK: leaq 32(%rsp), %rcx
32 call void @foo({ float, double }* byval({ float, double }) %arg)
36 declare void @foo2({ float, double }* byval({ float, double }), { float, double }* byval({ float, double }), { float, double }* byval({ float, double }), { float, double }* byval({ float, double }), { float, double }* byval({ float, double }), i64 %f)
37 @data = external constant { float, double }
41 ; CHECK: movq (%rax), %rcx
42 ; CHECK-NEXT: movq 8(%rax), %rax
43 ; CHECK-NEXT: movq %rax, 120(%rsp)
44 ; CHECK-NEXT: movq %rcx, 112(%rsp)
45 ; CHECK-NEXT: movq %rcx, 96(%rsp)
46 ; CHECK-NEXT: movq %rax, 104(%rsp)
47 ; CHECK-NEXT: movq %rcx, 80(%rsp)
48 ; CHECK-NEXT: movq %rax, 88(%rsp)
49 ; CHECK-NEXT: movq %rcx, 64(%rsp)
50 ; CHECK-NEXT: movq %rax, 72(%rsp)
51 ; CHECK-NEXT: movq %rax, 56(%rsp)
52 ; CHECK-NEXT: movq %rcx, 48(%rsp)
53 ; CHECK-NEXT: leaq 48(%rsp), %rax
54 ; CHECK-NEXT: movq %rax, 32(%rsp)
55 ; CHECK-NEXT: movq $10, 40(%rsp)
56 ; CHECK-NEXT: leaq 112(%rsp), %rcx
57 ; CHECK-NEXT: leaq 96(%rsp), %rdx
58 ; CHECK-NEXT: leaq 80(%rsp), %r8
59 ; CHECK-NEXT: leaq 64(%rsp), %r9
60 call void @foo2({ float, double }* byval({ float, double }) @G, { float, double }* byval({ float, double }) @G, { float, double }* byval({ float, double }) @G, { float, double }* byval({ float, double }) @G, { float, double }* byval({ float, double }) @G, i64 10)