1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=x86_64-windows -show-mc-encoding < %s | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker; The Win64 ABI wants tail jmps to use a REX_W prefix so it can distinguish 4*9880d681SAndroid Build Coastguard Worker; in-function jumps from function exiting jumps. 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Workerdefine void @tail_jmp_reg(i32, i32, void ()* %fptr) { 7*9880d681SAndroid Build Coastguard Worker tail call void () %fptr() 8*9880d681SAndroid Build Coastguard Worker ret void 9*9880d681SAndroid Build Coastguard Worker} 10*9880d681SAndroid Build Coastguard Worker 11*9880d681SAndroid Build Coastguard Worker; Check that we merge the REX prefixes into 0x49 instead of 0x48, 0x41. 12*9880d681SAndroid Build Coastguard Worker 13*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: tail_jmp_reg: 14*9880d681SAndroid Build Coastguard Worker; CHECK: rex64 jmpq *%r8 15*9880d681SAndroid Build Coastguard Worker; CHECK: encoding: [0x49,0xff,0xe0] 16*9880d681SAndroid Build Coastguard Worker 17*9880d681SAndroid Build Coastguard Workerdeclare void @tail_tgt() 18*9880d681SAndroid Build Coastguard Worker 19*9880d681SAndroid Build Coastguard Workerdefine void @tail_jmp_imm() { 20*9880d681SAndroid Build Coastguard Worker tail call void @tail_tgt() 21*9880d681SAndroid Build Coastguard Worker ret void 22*9880d681SAndroid Build Coastguard Worker} 23*9880d681SAndroid Build Coastguard Worker 24*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: tail_jmp_imm: 25*9880d681SAndroid Build Coastguard Worker; CHECK: rex64 jmp tail_tgt 26*9880d681SAndroid Build Coastguard Worker 27*9880d681SAndroid Build Coastguard Worker@g_fptr = global void ()* @tail_tgt 28*9880d681SAndroid Build Coastguard Worker 29*9880d681SAndroid Build Coastguard Workerdefine void @tail_jmp_mem() { 30*9880d681SAndroid Build Coastguard Worker %fptr = load void ()*, void ()** @g_fptr 31*9880d681SAndroid Build Coastguard Worker tail call void () %fptr() 32*9880d681SAndroid Build Coastguard Worker ret void 33*9880d681SAndroid Build Coastguard Worker} 34*9880d681SAndroid Build Coastguard Worker 35*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: tail_jmp_mem: 36*9880d681SAndroid Build Coastguard Worker; CHECK: rex64 jmpq *g_fptr(%rip) 37