va_args support for Win64.
[oota-llvm.git] / test / CodeGen / X86 / win64_vararg.ll
1 ; 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.
6 define void @average_va(i32 %count, ...) nounwind {
7 entry:
8 ; CHECK: subq   $40, %rsp
9 ; CHECK: movq   %r9, 72(%rsp)
10 ; CHECK: movq   %r8, 64(%rsp)
11 ; CHECK: movq   %rdx, 56(%rsp)
12 ; CHECK: leaq   56(%rsp), %rax
13
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
20 declare void @llvm.va_start(i8*) nounwind