9718c86300c25c4a13eab7a9d8531482febaf9f0
[oota-llvm.git] / test / CodeGen / X86 / win64_params.ll
1 ; RUN: llc < %s -mtriple=x86_64-pc-win32 | FileCheck %s
2 ; RUN: llc < %s -mtriple=x86_64-pc-linux | FileCheck %s -check-prefix=LINUX
3
4 ; Verify that the 5th and 6th parameters are coming from the correct location
5 ; on the stack.
6 define i32 @f6(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %p6) nounwind readnone optsize {
7 entry:
8 ; CHECK: movl    48(%rsp), %eax
9 ; CHECK: addl    40(%rsp), %eax
10 ; LINUX: addl    %r9d, %r8d
11 ; LINUX: movl    %r8d, %eax
12   %add = add nsw i32 %p6, %p5
13   ret i32 %add
14 }
15
16 define x86_64_win64cc i32 @f7(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %p6) nounwind readnone optsize {
17 entry:
18 ; CHECK: movl    48(%rsp), %eax
19 ; CHECK: addl    40(%rsp), %eax
20 ; LINUX: movl    48(%rsp), %eax
21 ; LINUX: addl    40(%rsp), %eax
22   %add = add nsw i32 %p6, %p5
23   ret i32 %add
24 }
25
26 ; Verify that even though we're compiling for Windows, parameters behave as
27 ; on other platforms here (note the x86_64_sysvcc calling convention).
28 define x86_64_sysvcc i32 @f8(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %p6) nounwind readnone optsize {
29 entry:
30 ; CHECK: addl    %r9d, %r8d
31 ; CHECK: movl    %r8d, %eax
32 ; LINUX: addl    %r9d, %r8d
33 ; LINUX: movl    %r8d, %eax
34   %add = add nsw i32 %p6, %p5
35   ret i32 %add
36 }