xref: /llvm-project/llvm/test/CodeGen/X86/sibcall-2.ll (revision 89873694654a635cabdd861ddebd61a041d8342f)
1; RUN: llc -verify-machineinstrs < %s -mtriple=i386-apple-darwin   -frame-pointer=all | FileCheck %s -check-prefix=X86
2; RUN: llc -verify-machineinstrs < %s -mtriple=x86_64-apple-darwin -frame-pointer=all | FileCheck %s -check-prefix=X64
3
4; Tail call should not use ebp / rbp after it's popped. Use esp / rsp.
5
6define void @t1(ptr nocapture %value) nounwind {
7entry:
8; X86-LABEL: t1:
9; X86: jmpl *4(%esp)
10
11; X64-LABEL: t1:
12; X64: jmpq *%rdi
13  tail call void %value() nounwind
14  ret void
15}
16
17define void @t2(i32 %a, ptr nocapture %value) nounwind {
18entry:
19; X86-LABEL: t2:
20; X86: jmpl *8(%esp)
21
22; X64-LABEL: t2:
23; X64: jmpq *%rsi
24  tail call void %value() nounwind
25  ret void
26}
27
28define void @t3(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f, ptr nocapture %value) nounwind {
29entry:
30; X86-LABEL: t3:
31; X86: jmpl *28(%esp)
32
33; X64-LABEL: t3:
34; X64: jmpq *8(%rsp)
35  tail call void %value() nounwind
36  ret void
37}
38
39define void @t4(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f, i32 %g, ptr nocapture %value) nounwind {
40entry:
41; X86-LABEL: t4:
42; X86: jmpl *32(%esp)
43
44; X64-LABEL: t4:
45; X64: jmpq *16(%rsp)
46  tail call void %value() nounwind
47  ret void
48}
49