diff options
| author | Reid Kleckner <reid@kleckner.net> | 2015-01-30 21:03:31 +0000 |
|---|---|---|
| committer | Reid Kleckner <reid@kleckner.net> | 2015-01-30 21:03:31 +0000 |
| commit | a580b6ec67ec605f563bc4e52a3490b9c951ce59 (patch) | |
| tree | bf75810381b3ebf19dc96018ebf99fff8b060c8b /llvm/test | |
| parent | a9a6f55840ff2909455ef578e179c8556de5822d (diff) | |
| download | bcm5719-llvm-a580b6ec67ec605f563bc4e52a3490b9c951ce59.tar.gz bcm5719-llvm-a580b6ec67ec605f563bc4e52a3490b9c951ce59.zip | |
Win64: Put a REX_W prefix on all TAILJMP* instructions
MSDN's x64 software conventions page says that this is one of the fixed
list of legal epilogues:
https://msdn.microsoft.com/en-us/library/tawsa7cb.aspx
Presumably this is how the unwinder distinguishes epilogue jumps from
in-function control flow.
Also normalize the way we place "## TAILCALL" comments on such jumps.
llvm-svn: 227611
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/CodeGen/X86/tail-call-win64.ll | 36 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/tailcall-64.ll | 4 |
2 files changed, 38 insertions, 2 deletions
diff --git a/llvm/test/CodeGen/X86/tail-call-win64.ll b/llvm/test/CodeGen/X86/tail-call-win64.ll new file mode 100644 index 00000000000..23e9280e772 --- /dev/null +++ b/llvm/test/CodeGen/X86/tail-call-win64.ll @@ -0,0 +1,36 @@ +; RUN: llc -mtriple=x86_64-windows -show-mc-encoding < %s | FileCheck %s + +; The Win64 ABI wants tail jmps to use a REX_W prefix so it can distinguish +; in-function jumps from function exiting jumps. + +define void @tail_jmp_reg(i32, i32, void ()* %fptr) { + tail call void ()* %fptr() + ret void +} + +; Check that we merge the REX prefixes into 0x49 instead of 0x48, 0x41. + +; CHECK-LABEL: tail_jmp_reg: +; CHECK: rex64 jmpq *%r8 +; CHECK: encoding: [0x49,0xff,0xe0] + +declare void @tail_tgt() + +define void @tail_jmp_imm() { + tail call void @tail_tgt() + ret void +} + +; CHECK-LABEL: tail_jmp_imm: +; CHECK: rex64 jmp tail_tgt + +@g_fptr = global void ()* @tail_tgt + +define void @tail_jmp_mem() { + %fptr = load void ()** @g_fptr + tail call void ()* %fptr() + ret void +} + +; CHECK-LABEL: tail_jmp_mem: +; CHECK: rex64 jmpq *g_fptr(%rip) diff --git a/llvm/test/CodeGen/X86/tailcall-64.ll b/llvm/test/CodeGen/X86/tailcall-64.ll index deab1dcc7eb..25d3802ab61 100644 --- a/llvm/test/CodeGen/X86/tailcall-64.ll +++ b/llvm/test/CodeGen/X86/tailcall-64.ll @@ -182,7 +182,7 @@ define { i64, i64 } @crash(i8* %this) { ; Check that we can fold an indexed load into a tail call instruction. ; CHECK: fold_indexed_load ; CHECK: leaq (%rsi,%rsi,4), %[[RAX:r..]] -; CHECK: jmpq *16(%{{r..}},%[[RAX]],8) # TAILCALL +; CHECK: jmpq *16(%{{r..}},%[[RAX]],8) ## TAILCALL %struct.funcs = type { i32 (i8*, i32*, i32)*, i32 (i8*)*, i32 (i8*)*, i32 (i8*, i32)*, i32 } @func_table = external global [0 x %struct.funcs] define void @fold_indexed_load(i8* %mbstr, i64 %idxprom) nounwind uwtable ssp { @@ -207,7 +207,7 @@ entry: ; } ; ; CHECK-LABEL: rdar12282281 -; CHECK: jmpq *%r11 # TAILCALL +; CHECK: jmpq *%r11 ## TAILCALL @funcs = external constant [0 x i32 (i8*, ...)*] define i32 @rdar12282281(i32 %n) nounwind uwtable ssp { |

