1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=aarch64-linux-gnu | FileCheck %s
3 ; RUN: llc < %s --global-isel=1 -mtriple=aarch64-apple-darwin | FileCheck %s --check-prefix=DARWIN
5 define win64cc void @pass_va(i32 %count, ...) nounwind {
6 ; CHECK-LABEL: pass_va:
7 ; CHECK: // %bb.0: // %entry
8 ; CHECK-NEXT: sub sp, sp, #96
9 ; CHECK-NEXT: add x8, sp, #40
10 ; CHECK-NEXT: add x0, sp, #40
11 ; CHECK-NEXT: stp x30, x18, [sp, #16] // 16-byte Folded Spill
12 ; CHECK-NEXT: stp x1, x2, [sp, #40]
13 ; CHECK-NEXT: stp x3, x4, [sp, #56]
14 ; CHECK-NEXT: stp x5, x6, [sp, #72]
15 ; CHECK-NEXT: str x7, [sp, #88]
16 ; CHECK-NEXT: str x8, [sp, #8]
17 ; CHECK-NEXT: bl other_func
18 ; CHECK-NEXT: ldp x30, x18, [sp, #16] // 16-byte Folded Reload
19 ; CHECK-NEXT: add sp, sp, #96
22 ; DARWIN-LABEL: pass_va:
23 ; DARWIN: ; %bb.0: ; %entry
24 ; DARWIN-NEXT: str x18, [sp, #-96]! ; 8-byte Folded Spill
25 ; DARWIN-NEXT: add x8, sp, #8
26 ; DARWIN-NEXT: add x9, sp, #40
27 ; DARWIN-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill
28 ; DARWIN-NEXT: str x9, [x8]
29 ; DARWIN-NEXT: ldr x0, [sp, #8]
30 ; DARWIN-NEXT: stp x1, x2, [sp, #40]
31 ; DARWIN-NEXT: stp x3, x4, [sp, #56]
32 ; DARWIN-NEXT: stp x5, x6, [sp, #72]
33 ; DARWIN-NEXT: str x7, [sp, #88]
34 ; DARWIN-NEXT: bl _other_func
35 ; DARWIN-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
36 ; DARWIN-NEXT: ldr x18, [sp], #96 ; 8-byte Folded Reload
39 %ap = alloca ptr, align 8
40 call void @llvm.va_start(ptr %ap)
41 %ap2 = load ptr, ptr %ap, align 8
42 call void @other_func(ptr %ap2)
46 declare void @other_func(ptr) local_unnamed_addr
48 declare void @llvm.va_start(ptr) nounwind
49 declare void @llvm.va_copy(ptr, ptr) nounwind
51 define win64cc ptr @f9(i64 %a0, i64 %a1, i64 %a2, i64 %a3, i64 %a4, i64 %a5, i64 %a6, i64 %a7, i64 %a8, ...) nounwind {
53 ; CHECK: // %bb.0: // %entry
54 ; CHECK-NEXT: str x18, [sp, #-16]! // 8-byte Folded Spill
55 ; CHECK-NEXT: add x8, sp, #24
56 ; CHECK-NEXT: add x0, sp, #24
57 ; CHECK-NEXT: str x8, [sp, #8]
58 ; CHECK-NEXT: ldr x18, [sp], #16 // 8-byte Folded Reload
62 ; DARWIN: ; %bb.0: ; %entry
63 ; DARWIN-NEXT: str x18, [sp, #-16]! ; 8-byte Folded Spill
64 ; DARWIN-NEXT: add x8, sp, #8
65 ; DARWIN-NEXT: add x9, sp, #24
66 ; DARWIN-NEXT: str x9, [x8]
67 ; DARWIN-NEXT: ldr x0, [sp, #8]
68 ; DARWIN-NEXT: ldr x18, [sp], #16 ; 8-byte Folded Reload
71 %ap = alloca ptr, align 8
72 call void @llvm.va_start(ptr %ap)
73 %ap2 = load ptr, ptr %ap, align 8
77 define win64cc ptr @f8(i64 %a0, i64 %a1, i64 %a2, i64 %a3, i64 %a4, i64 %a5, i64 %a6, i64 %a7, ...) nounwind {
79 ; CHECK: // %bb.0: // %entry
80 ; CHECK-NEXT: str x18, [sp, #-16]! // 8-byte Folded Spill
81 ; CHECK-NEXT: add x8, sp, #16
82 ; CHECK-NEXT: add x0, sp, #16
83 ; CHECK-NEXT: str x8, [sp, #8]
84 ; CHECK-NEXT: ldr x18, [sp], #16 // 8-byte Folded Reload
88 ; DARWIN: ; %bb.0: ; %entry
89 ; DARWIN-NEXT: str x18, [sp, #-16]! ; 8-byte Folded Spill
90 ; DARWIN-NEXT: add x8, sp, #8
91 ; DARWIN-NEXT: add x9, sp, #16
92 ; DARWIN-NEXT: str x9, [x8]
93 ; DARWIN-NEXT: ldr x0, [sp, #8]
94 ; DARWIN-NEXT: ldr x18, [sp], #16 ; 8-byte Folded Reload
97 %ap = alloca ptr, align 8
98 call void @llvm.va_start(ptr %ap)
99 %ap2 = load ptr, ptr %ap, align 8
103 define win64cc ptr @f7(i64 %a0, i64 %a1, i64 %a2, i64 %a3, i64 %a4, i64 %a5, i64 %a6, ...) nounwind {
105 ; CHECK: // %bb.0: // %entry
106 ; CHECK-NEXT: str x18, [sp, #-32]! // 8-byte Folded Spill
107 ; CHECK-NEXT: add x8, sp, #24
108 ; CHECK-NEXT: add x0, sp, #24
109 ; CHECK-NEXT: str x7, [sp, #24]
110 ; CHECK-NEXT: str x8, [sp, #8]
111 ; CHECK-NEXT: ldr x18, [sp], #32 // 8-byte Folded Reload
115 ; DARWIN: ; %bb.0: ; %entry
116 ; DARWIN-NEXT: str x18, [sp, #-32]! ; 8-byte Folded Spill
117 ; DARWIN-NEXT: add x8, sp, #8
118 ; DARWIN-NEXT: add x9, sp, #24
119 ; DARWIN-NEXT: str x7, [sp, #24]
120 ; DARWIN-NEXT: str x9, [x8]
121 ; DARWIN-NEXT: ldr x0, [sp, #8]
122 ; DARWIN-NEXT: ldr x18, [sp], #32 ; 8-byte Folded Reload
125 %ap = alloca ptr, align 8
126 call void @llvm.va_start(ptr %ap)
127 %ap2 = load ptr, ptr %ap, align 8