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