1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

[XCore] Fix call of absolute address.

Previously for:

tail call void inttoptr (i64 65536 to void ()*)() nounwind

We would emit:

bl 65536

The immediate operand of the bl instruction is a relative offset so it is
wrong to use the absolute address here.

llvm-svn: 202860
This commit is contained in:
Richard Osborne 2014-03-04 16:50:30 +00:00
parent 87494a0d7f
commit b9f5c6e728
2 changed files with 12 additions and 3 deletions

View File

@ -718,10 +718,10 @@ def BLACP_u10 : _FU10<0b111000, (outs), (ins i32imm:$a), "bla cp[$a]", []>;
def BLACP_lu10 : _FLU10<0b111000, (outs), (ins i32imm:$a), "bla cp[$a]", []>;
def BLRF_u10 : _FU10<0b110100, (outs), (ins pcrel_imm:$a), "bl $a",
[(XCoreBranchLink immU10:$a)]>;
[]>;
def BLRF_lu10 : _FLU10<0b110100, (outs), (ins pcrel_imm:$a), "bl $a",
[(XCoreBranchLink immU20:$a)]>;
[(XCoreBranchLink tglobaladdr:$a)]>;
def BLRB_u10 : _FU10<0b110101, (outs), (ins pcrel_imm_neg:$a), "bl $a", []>;
@ -1113,7 +1113,6 @@ def WAITEU_0R : _F0R<0b0000001100, (outs), (ins),
// Non-Instruction Patterns
//===----------------------------------------------------------------------===//
def : Pat<(XCoreBranchLink tglobaladdr:$addr), (BLRF_lu10 tglobaladdr:$addr)>;
def : Pat<(XCoreBranchLink texternalsym:$addr), (BLRF_lu10 texternalsym:$addr)>;
/// sext_inreg

View File

@ -0,0 +1,10 @@
; RUN: llc < %s -march=xcore | FileCheck %s
; CHECK-LABEL: bl_imm:
; CHECK: ldw [[R0:r[0-9]+]], cp
; CHECK: bla [[R0]]
define void @bl_imm() nounwind {
entry:
tail call void inttoptr (i64 65536 to void ()*)() nounwind
ret void
}