1 ; RUN: llc < %s -mtriple=x86_64-pc-linux | FileCheck %s
3 declare dso_local win64cc void @win64_callee(i32)
4 declare dso_local win64cc ptr @win64_indirect()
5 declare dso_local win64cc void @win64_other(i32)
6 declare dso_local void @sysv_callee(i32)
7 declare dso_local ptr @sysv_indirect()
8 declare dso_local void @sysv_other(i32)
10 define void @sysv_caller(i32 %p1) {
12 tail call win64cc void @win64_callee(i32 %p1)
16 ; CHECK-LABEL: sysv_caller:
17 ; CHECK: subq $40, %rsp
18 ; CHECK: callq win64_callee
19 ; CHECK: addq $40, %rsp
22 define win64cc void @win64_caller(i32 %p1) {
24 tail call void @sysv_callee(i32 %p1)
28 ; CHECK-LABEL: win64_caller:
29 ; CHECK: callq sysv_callee
32 define void @sysv_matched(i32 %p1) {
33 tail call void @sysv_callee(i32 %p1)
37 ; CHECK-LABEL: sysv_matched:
38 ; CHECK: jmp sysv_callee # TAILCALL
40 define win64cc void @win64_matched(i32 %p1) {
41 tail call win64cc void @win64_callee(i32 %p1)
45 ; CHECK-LABEL: win64_matched:
46 ; CHECK: jmp win64_callee # TAILCALL
48 define win64cc void @win64_indirect_caller(i32 %p1) {
49 %1 = call win64cc ptr @win64_indirect()
50 call win64cc void @win64_other(i32 0)
51 tail call win64cc void %1(i32 %p1)
55 ; CHECK-LABEL: win64_indirect_caller:
56 ; CHECK: jmpq *%{{rax|rcx|rdx|r8|r9|r11}} # TAILCALL
58 define void @sysv_indirect_caller(i32 %p1) {
59 %1 = call ptr @sysv_indirect()
60 call void @sysv_other(i32 0)
61 tail call void %1(i32 %p1)
65 ; CHECK-LABEL: sysv_indirect_caller:
66 ; CHECK: jmpq *%{{rax|rcx|rdx|rsi|rdi|r8|r9|r11}} # TAILCALL