Implement MipsHi for mips16

llvm-svn: 166852
This commit is contained in:
Reed Kotler 2012-10-27 00:57:14 +00:00
parent 6a124a84dc
commit 7e4d9969cb
2 changed files with 23 additions and 2 deletions

View File

@ -1437,6 +1437,14 @@ def: SetCC_R16<setult, SltuCCRxRy16>;
def: SetCC_I16<setult, immSExt16, SltiuCCRxImmX16>;
def: Mips16Pat<(add CPU16Regs:$hi, (MipsLo tglobaladdr:$lo)),
(AddiuRxRxImmX16 CPU16Regs:$hi, tglobaladdr:$lo)>;
// hi/lo relocs
def : Mips16Pat<(MipsHi tglobaltlsaddr:$in),
(SllX16 (LiRxImmX16 tglobaltlsaddr:$in), 16)>;
// wrapper_pic
class Wrapper16Pat<SDNode node, Instruction ADDiuOp, RegisterClass RC>:
Mips16Pat<(MipsWrapper RC:$gp, node:$in),
@ -1445,5 +1453,3 @@ class Wrapper16Pat<SDNode node, Instruction ADDiuOp, RegisterClass RC>:
def : Wrapper16Pat<tglobaltlsaddr, AddiuRxRxImmX16, CPU16Regs>;
def: Mips16Pat<(add CPU16Regs:$hi, (MipsLo tglobaladdr:$lo)),
(AddiuRxRxImmX16 CPU16Regs:$hi, tglobaladdr:$lo)>;

View File

@ -0,0 +1,15 @@
; RUN: llc -march=mipsel -mcpu=mips16 -relocation-model=pic -O3 < %s | FileCheck %s -check-prefix=PIC16
@f.i = internal thread_local unnamed_addr global i32 1, align 4
define i8* @f(i8* nocapture %a) nounwind {
entry:
%0 = load i32* @f.i, align 4
%inc = add nsw i32 %0, 1
store i32 %inc, i32* @f.i, align 4
%1 = inttoptr i32 %inc to i8*
; PIC16: addiu ${{[0-9]+}}, %tlsldm(f.i)
ret i8* %1
}