From 56a6a7d3bde9c4e38eb3f50a15f2ebc598dc03bc Mon Sep 17 00:00:00 2001 From: Jozef Kolek Date: Thu, 27 Nov 2014 18:18:42 +0000 Subject: [PATCH] [mips][microMIPS] Implement BREAK16 and SDBBP16 instructions Patch by Radovan Obradovic. Differential Revision: http://reviews.llvm.org/D5048 llvm-svn: 222900 --- llvm/lib/Target/Mips/MicroMipsInstrFormats.td | 9 +++++++++ llvm/lib/Target/Mips/MicroMipsInstrInfo.td | 8 ++++++++ llvm/test/MC/Mips/micromips-16-bit-instructions.s | 6 ++++++ 3 files changed, 23 insertions(+) diff --git a/llvm/lib/Target/Mips/MicroMipsInstrFormats.td b/llvm/lib/Target/Mips/MicroMipsInstrFormats.td index 8a924e9..dcd0e59 100644 --- a/llvm/lib/Target/Mips/MicroMipsInstrFormats.td +++ b/llvm/lib/Target/Mips/MicroMipsInstrFormats.td @@ -207,6 +207,15 @@ class ADDIUR1SP_FM_MM16 { let Inst{0} = 1; } +class BRKSDBBP16_FM_MM op> { + bits<4> code_; + bits<16> Inst; + + let Inst{15-10} = 0x11; + let Inst{9-4} = op; + let Inst{3-0} = code_; +} + //===----------------------------------------------------------------------===// // MicroMIPS 32-bit Instruction Formats //===----------------------------------------------------------------------===// diff --git a/llvm/lib/Target/Mips/MicroMipsInstrInfo.td b/llvm/lib/Target/Mips/MicroMipsInstrInfo.td index d7127a8..bfd0530 100644 --- a/llvm/lib/Target/Mips/MicroMipsInstrInfo.td +++ b/llvm/lib/Target/Mips/MicroMipsInstrInfo.td @@ -296,6 +296,12 @@ class JumpRegCMM16 : let isIndirectBranch = 1; } +// Break16 and Sdbbp16 +class BrkSdbbp16MM : + MicroMipsInst16<(outs), (ins uimm4:$code_), + !strconcat(opstr, "\t$code_"), + [], NoItinerary, FrmOther>; + // MicroMIPS Jump and Link (Call) - Short Delay Slot let isCall = 1, hasDelaySlot = 1, Defs = [RA] in { class JumpLinkMM : @@ -392,6 +398,8 @@ 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>; +def BREAK16_MM : BrkSdbbp16MM<"break16">, BRKSDBBP16_FM_MM<0x28>; +def SDBBP16_MM : BrkSdbbp16MM<"sdbbp16">, BRKSDBBP16_FM_MM<0x2C>; class WaitMM : InstSE<(outs), (ins uimm10:$code_), !strconcat(opstr, "\t$code_"), [], diff --git a/llvm/test/MC/Mips/micromips-16-bit-instructions.s b/llvm/test/MC/Mips/micromips-16-bit-instructions.s index 2dfec79..8529350 100644 --- a/llvm/test/MC/Mips/micromips-16-bit-instructions.s +++ b/llvm/test/MC/Mips/micromips-16-bit-instructions.s @@ -43,6 +43,8 @@ # CHECK-EL: move $zero, $zero # encoding: [0x00,0x0c] # CHECK-EL: jr16 $9 # encoding: [0x89,0x45] # CHECK-EL: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-EL: break16 8 # encoding: [0x88,0x46] +# CHECK-EL: sdbbp16 14 # encoding: [0xce,0x46] #------------------------------------------------------------------------------ # Big endian #------------------------------------------------------------------------------ @@ -80,6 +82,8 @@ # CHECK-EB: move $zero, $zero # encoding: [0x0c,0x00] # CHECK-EB: jr16 $9 # encoding: [0x45,0x89] # CHECK-EB: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-EB: break16 8 # encoding: [0x46,0x88] +# CHECK-EB: sdbbp16 14 # encoding: [0x46,0xce] addu16 $6, $17, $4 subu16 $5, $16, $3 @@ -113,3 +117,5 @@ jraddiusp 20 jalrs16 $9 jr16 $9 + break16 8 + sdbbp16 14 -- 2.7.4