2015-02-27 03:43:20 +08:00
|
|
|
; RUN: llc < %s -mtriple=x86_64-pc-linux | FileCheck %s
|
|
|
|
|
2017-07-18 04:05:19 +08:00
|
|
|
declare win64cc void @win64_callee(i32)
|
|
|
|
declare win64cc void (i32)* @win64_indirect()
|
|
|
|
declare win64cc void @win64_other(i32)
|
2015-02-27 03:43:20 +08:00
|
|
|
declare void @sysv_callee(i32)
|
2015-06-05 06:50:05 +08:00
|
|
|
declare void (i32)* @sysv_indirect()
|
|
|
|
declare void @sysv_other(i32)
|
2015-02-27 03:43:20 +08:00
|
|
|
|
|
|
|
define void @sysv_caller(i32 %p1) {
|
|
|
|
entry:
|
2017-07-18 04:05:19 +08:00
|
|
|
tail call win64cc void @win64_callee(i32 %p1)
|
2015-02-27 03:43:20 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: sysv_caller:
|
|
|
|
; CHECK: subq $40, %rsp
|
|
|
|
; CHECK: callq win64_callee
|
|
|
|
; CHECK: addq $40, %rsp
|
|
|
|
; CHECK: retq
|
|
|
|
|
2017-07-18 04:05:19 +08:00
|
|
|
define win64cc void @win64_caller(i32 %p1) {
|
2015-02-27 03:43:20 +08:00
|
|
|
entry:
|
|
|
|
tail call void @sysv_callee(i32 %p1)
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: win64_caller:
|
|
|
|
; CHECK: callq sysv_callee
|
|
|
|
; CHECK: retq
|
|
|
|
|
|
|
|
define void @sysv_matched(i32 %p1) {
|
|
|
|
tail call void @sysv_callee(i32 %p1)
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: sysv_matched:
|
|
|
|
; CHECK: jmp sysv_callee # TAILCALL
|
|
|
|
|
2017-07-18 04:05:19 +08:00
|
|
|
define win64cc void @win64_matched(i32 %p1) {
|
|
|
|
tail call win64cc void @win64_callee(i32 %p1)
|
2015-02-27 03:43:20 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: win64_matched:
|
|
|
|
; CHECK: jmp win64_callee # TAILCALL
|
2015-06-05 06:50:05 +08:00
|
|
|
|
2017-07-18 04:05:19 +08:00
|
|
|
define win64cc void @win64_indirect_caller(i32 %p1) {
|
|
|
|
%1 = call win64cc void (i32)* @win64_indirect()
|
|
|
|
call win64cc void @win64_other(i32 0)
|
|
|
|
tail call win64cc void %1(i32 %p1)
|
2015-06-05 06:50:05 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: win64_indirect_caller:
|
|
|
|
; CHECK: jmpq *%{{rax|rcx|rdx|r8|r9|r11}} # TAILCALL
|
|
|
|
|
|
|
|
define void @sysv_indirect_caller(i32 %p1) {
|
|
|
|
%1 = call void (i32)* @sysv_indirect()
|
|
|
|
call void @sysv_other(i32 0)
|
|
|
|
tail call void %1(i32 %p1)
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: sysv_indirect_caller:
|
|
|
|
; CHECK: jmpq *%{{rax|rcx|rdx|rsi|rdi|r8|r9|r11}} # TAILCALL
|