Skip to content

Commit

Permalink
[mips][microMIPS] Implement BREAK16 and SDBBP16 instructions
Browse files Browse the repository at this point in the history
Patch by Radovan Obradovic.

Differential Revision: http://reviews.llvm.org/D5048


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222900 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Jozef Kolek committed Nov 27, 2014
1 parent 68de93c commit 13fbabb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/Target/Mips/MicroMipsInstrFormats.td
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,15 @@ class ADDIUR1SP_FM_MM16 {
let Inst{0} = 1;
}

class BRKSDBBP16_FM_MM<bits<6> 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
//===----------------------------------------------------------------------===//
Expand Down
8 changes: 8 additions & 0 deletions lib/Target/Mips/MicroMipsInstrInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,12 @@ class JumpRegCMM16<string opstr, RegisterOperand RO> :
let isIndirectBranch = 1;
}

// Break16 and Sdbbp16
class BrkSdbbp16MM<string opstr> :
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<string opstr, DAGOperand opnd> :
Expand Down Expand Up @@ -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<string opstr> :
InstSE<(outs), (ins uimm10:$code_), !strconcat(opstr, "\t$code_"), [],
Expand Down
6 changes: 6 additions & 0 deletions test/MC/Mips/micromips-16-bit-instructions.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
#------------------------------------------------------------------------------
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -113,3 +117,5 @@
jraddiusp 20
jalrs16 $9
jr16 $9
break16 8
sdbbp16 14

0 comments on commit 13fbabb

Please sign in to comment.