1 ; RUN: llc < %s -mtriple=aarch64-windows -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK,DAGISEL
2 ; RUN: llc < %s -mtriple=aarch64-windows -verify-machineinstrs -O0 -fast-isel | FileCheck %s --check-prefixes=CHECK,O0
3 ; RUN: llc < %s -mtriple=aarch64-windows -verify-machineinstrs -O0 -global-isel | FileCheck %s --check-prefixes=CHECK,O0
5 define void @float_va_fn(float %a, i32 %b, ...) nounwind {
7 ; CHECK-LABEL: float_va_fn:
8 ; O0: str x7, [sp, #72]
9 ; O0: str x6, [sp, #64]
10 ; O0: str x5, [sp, #56]
11 ; O0: str x4, [sp, #48]
12 ; O0: str x3, [sp, #40]
13 ; O0: str x2, [sp, #32]
16 ; O0: str x8, [sp, #8]
17 ; O0: ldr x0, [sp, #8]
18 ; DAGISEL: add x0, sp, #16
19 ; DAGISEL: stp x2, x3, [sp, #16]
20 ; DAGISEL: stp x4, x5, [sp, #32]
21 ; DAGISEL: stp x6, x7, [sp, #48]
23 %ap = alloca i8*, align 8
24 %0 = bitcast i8** %ap to i8*
25 call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %0)
26 call void @llvm.va_start(i8* nonnull %0)
27 %1 = load i8*, i8** %ap, align 8
28 call void @f_va_list(float %a, i8* %1)
29 call void @llvm.va_end(i8* nonnull %0)
30 call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %0)
34 declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture)
35 declare void @llvm.va_start(i8*)
36 declare void @f_va_list(float, i8*)
37 declare void @llvm.va_end(i8*)
38 declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture)
40 define void @double_va_fn(double %a, i32 %b, ...) nounwind {
42 ; CHECK-LABEL: double_va_fn:
43 ; O0: str x7, [sp, #72]
44 ; O0: str x6, [sp, #64]
45 ; O0: str x5, [sp, #56]
46 ; O0: str x4, [sp, #48]
47 ; O0: str x3, [sp, #40]
48 ; O0: str x2, [sp, #32]
51 ; O0: str x8, [sp, #8]
52 ; O0: ldr x0, [sp, #8]
53 ; DAGISEL: add x0, sp, #16
54 ; DAGISEL: stp x2, x3, [sp, #16]
55 ; DAGISEL: stp x4, x5, [sp, #32]
56 ; DAGISEL: stp x6, x7, [sp, #48]
58 %ap = alloca i8*, align 8
59 %0 = bitcast i8** %ap to i8*
60 call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %0)
61 call void @llvm.va_start(i8* nonnull %0)
62 %1 = load i8*, i8** %ap, align 8
63 call void @d_va_list(double %a, i8* %1)
64 call void @llvm.va_end(i8* nonnull %0)
65 call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %0)
69 declare void @d_va_list(double, i8*)
71 define void @call_f_va() nounwind {
73 ; CHECK-LABEL: call_f_va:
74 ; DAGISEL: mov w0, #1065353216
75 ; FASTISEL: mov w0, #1065353216
76 ; GISEL: fmov s0, #1.00000000
79 ; DAGISEL: mov x2, #4613937818241073152
80 ; FASTISEL: mov x2, #4613937818241073152
81 ; GISEL: fmov d0, #3.00000000
84 ; CHECK: b other_f_va_fn
85 tail call void (float, i32, ...) @other_f_va_fn(float 1.000000e+00, i32 2, double 3.000000e+00, i32 4)
89 declare void @other_f_va_fn(float, i32, ...)
91 define void @call_d_va() nounwind {
93 ; CHECK-LABEL: call_d_va:
94 ; DAGISEL: mov x0, #4607182418800017408
95 ; FASTISEL: mov x0, #4607182418800017408
96 ; GISEL: fmov d0, #1.00000000
99 ; DAGISEL: mov x2, #4613937818241073152
100 ; FASTISEL: mov x2, #4613937818241073152
101 ; GISEL: fmov d0, #3.00000000
103 ; CHECK: b other_d_va_fn
104 tail call void (double, i32, ...) @other_d_va_fn(double 1.000000e+00, i32 2, double 3.000000e+00, i32 4)
108 declare void @other_d_va_fn(double, i32, ...)
110 define void @call_d_non_va() nounwind {
112 ; CHECK-LABEL: call_d_non_va:
113 ; CHECK-DAG: fmov d0, #1.00000000
114 ; CHECK-DAG: fmov d1, #3.00000000
115 ; CHECK-DAG: mov w0, #2
116 ; CHECK-DAG: mov w1, #4
117 ; CHECK: b other_d_non_va_fn
118 tail call void (double, i32, double, i32) @other_d_non_va_fn(double 1.000000e+00, i32 2, double 3.000000e+00, i32 4)
122 declare void @other_d_non_va_fn(double, i32, double, i32)