blob: efe8bcacbeae299abaa33a2ff958af5d2e59d373 [file] [log] [blame]
Anton Korobeynikove7beda12010-10-03 22:52:07 +00001; RUN: llc < %s -mtriple=x86_64-pc-win32 | FileCheck %s
2
3; Verify that the var arg parameters which are passed in registers are stored
4; in home stack slots allocated by the caller and that AP is correctly
5; calculated.
6define void @average_va(i32 %count, ...) nounwind {
7entry:
NAKAMURA Takumi3f4be4f2011-02-05 15:11:32 +00008; CHECK: pushq
9; CHECK: movq %r9, 40(%rsp)
10; CHECK: movq %r8, 32(%rsp)
11; CHECK: movq %rdx, 24(%rsp)
12; CHECK: leaq 24(%rsp), %rax
Anton Korobeynikove7beda12010-10-03 22:52:07 +000013
14 %ap = alloca i8*, align 8 ; <i8**> [#uses=1]
15 %ap1 = bitcast i8** %ap to i8* ; <i8*> [#uses=1]
16 call void @llvm.va_start(i8* %ap1)
17 ret void
18}
19
20declare void @llvm.va_start(i8*) nounwind
NAKAMURA Takumi3ca99432011-03-09 11:33:15 +000021
22; CHECK: f5:
23; CHECK: pushq
24; CHECK: leaq 56(%rsp),
25define i8* @f5(i64 %a0, i64 %a1, i64 %a2, i64 %a3, i64 %a4, ...) nounwind {
26entry:
27 %ap = alloca i8*, align 8
28 %ap1 = bitcast i8** %ap to i8*
29 call void @llvm.va_start(i8* %ap1)
30 ret i8* %ap1
31}
32
33; CHECK: f4:
34; CHECK: pushq
35; CHECK: leaq 48(%rsp),
36define i8* @f4(i64 %a0, i64 %a1, i64 %a2, i64 %a3, ...) nounwind {
37entry:
38 %ap = alloca i8*, align 8
39 %ap1 = bitcast i8** %ap to i8*
40 call void @llvm.va_start(i8* %ap1)
41 ret i8* %ap1
42}
43
44; CHECK: f3:
45; CHECK: pushq
46; CHECK: leaq 40(%rsp),
47define i8* @f3(i64 %a0, i64 %a1, i64 %a2, ...) nounwind {
48entry:
49 %ap = alloca i8*, align 8
50 %ap1 = bitcast i8** %ap to i8*
51 call void @llvm.va_start(i8* %ap1)
52 ret i8* %ap1
53}