Anton Korobeynikov | e7beda1 | 2010-10-03 22:52:07 +0000 | [diff] [blame] | 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: |
NAKAMURA Takumi | 3f4be4f | 2011-02-05 15:11:32 +0000 | [diff] [blame] | 8 | ; 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 Korobeynikov | e7beda1 | 2010-10-03 22:52:07 +0000 | [diff] [blame] | 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 |
NAKAMURA Takumi | 3ca9943 | 2011-03-09 11:33:15 +0000 | [diff] [blame] | 21 | |
| 22 | ; CHECK: f5: |
| 23 | ; CHECK: pushq |
| 24 | ; CHECK: leaq 56(%rsp), |
| 25 | define i8* @f5(i64 %a0, i64 %a1, i64 %a2, i64 %a3, i64 %a4, ...) nounwind { |
| 26 | entry: |
| 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), |
| 36 | define i8* @f4(i64 %a0, i64 %a1, i64 %a2, i64 %a3, ...) nounwind { |
| 37 | entry: |
| 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), |
| 47 | define i8* @f3(i64 %a0, i64 %a1, i64 %a2, ...) nounwind { |
| 48 | entry: |
| 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 | } |