From 24335e60c71bc52c2b2779be4bd34f8712966031 Mon Sep 17 00:00:00 2001 From: Zoran Jovanovic Date: Fri, 10 Oct 2014 14:02:44 +0000 Subject: [PATCH] [mips][microMIPS] Implement JR16 instruction Differential Revision: http://reviews.llvm.org/D5062 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219498 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Mips/MicroMipsInstrInfo.td | 10 ++++++++++ test/MC/Mips/micromips-16-bit-instructions.s | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/lib/Target/Mips/MicroMipsInstrInfo.td b/lib/Target/Mips/MicroMipsInstrInfo.td index 71abfcd82ef..df90290de5f 100644 --- a/lib/Target/Mips/MicroMipsInstrInfo.td +++ b/lib/Target/Mips/MicroMipsInstrInfo.td @@ -117,6 +117,15 @@ class JumpLinkRegMM16 : let Defs = [RA]; } +// 16-bit Jump Reg +class JumpRegMM16 : + MicroMipsInst16<(outs), (ins RO:$rs), !strconcat(opstr, "\t$rs"), + [], IIBranch, FrmR> { + let hasDelaySlot = 1; + let isBranch = 1; + let isIndirectBranch = 1; +} + // Base class for JRADDIUSP instruction. class JumpRAddiuStackMM16 : MicroMipsInst16<(outs), (ins uimm5_lsl2:$imm), "jraddiusp\t$imm", @@ -173,6 +182,7 @@ def JALR16_MM : JumpLinkRegMM16<"jalr", GPR32Opnd>, JALR_FM_MM16<0x0e>; def JALRS16_MM : JumpLinkRegSMM16<"jalrs16", GPR32Opnd>, JALR_FM_MM16<0x0f>; def JRC16_MM : JumpRegCMM16<"jrc", GPR32Opnd>, JALR_FM_MM16<0x0d>; def JRADDIUSP : JumpRAddiuStackMM16, JRADDIUSP_FM_MM16<0x18>; +def JR16_MM : JumpRegMM16<"jr16", GPR32Opnd>, JALR_FM_MM16<0x0c>; class WaitMM : InstSE<(outs), (ins uimm10:$code_), !strconcat(opstr, "\t$code_"), [], diff --git a/test/MC/Mips/micromips-16-bit-instructions.s b/test/MC/Mips/micromips-16-bit-instructions.s index c9d22936d32..25582df2dd9 100644 --- a/test/MC/Mips/micromips-16-bit-instructions.s +++ b/test/MC/Mips/micromips-16-bit-instructions.s @@ -19,6 +19,8 @@ # CHECK-EL: nop # encoding: [0x00,0x00,0x00,0x00] # CHECK-EL: jalrs16 $9 # encoding: [0xe9,0x45] # CHECK-EL: move $zero, $zero # encoding: [0x00,0x0c] +# CHECK-EL: jr16 $9 # encoding: [0x89,0x45] +# CHECK-EL: nop # encoding: [0x00,0x00,0x00,0x00] #------------------------------------------------------------------------------ # Big endian #------------------------------------------------------------------------------ @@ -32,6 +34,8 @@ # CHECK-EB: nop # encoding: [0x00,0x00,0x00,0x00] # CHECK-EB: jalrs16 $9 # encoding: [0x45,0xe9] # CHECK-EB: move $zero, $zero # encoding: [0x0c,0x00] +# CHECK-EB: jr16 $9 # encoding: [0x45,0x89] +# CHECK-EB: nop # encoding: [0x00,0x00,0x00,0x00] addius5 $7, -2 mfhi $9 @@ -41,3 +45,4 @@ jalr $9 jraddiusp 20 jalrs16 $9 + jr16 $9 -- 2.34.1