diff --git a/llvm/lib/Target/Mips/MipsInstrFormats.td b/llvm/lib/Target/Mips/MipsInstrFormats.td index b2633df21b31..58e409939bf4 100644 --- a/llvm/lib/Target/Mips/MipsInstrFormats.td +++ b/llvm/lib/Target/Mips/MipsInstrFormats.td @@ -279,6 +279,17 @@ class BGEZ_FM op, bits<5> funct> { let Inst{15-0} = offset; } +class B_FM { + bits<16> offset; + + bits<32> Inst; + + let Inst{31-26} = 4; + let Inst{25-21} = 0; + let Inst{20-16} = 0; + let Inst{15-0} = offset; +} + //===----------------------------------------------------------------------===// // // FLOATING POINT INSTRUCTION FORMATS diff --git a/llvm/lib/Target/Mips/MipsInstrInfo.td b/llvm/lib/Target/Mips/MipsInstrInfo.td index 4f5560ac158a..5fce6391b4b9 100644 --- a/llvm/lib/Target/Mips/MipsInstrInfo.td +++ b/llvm/lib/Target/Mips/MipsInstrInfo.td @@ -596,11 +596,9 @@ class JumpFJ op, DAGOperand opnd, string instr_asm, } // Unconditional branch -class UncondBranch op, string instr_asm>: - BranchBase { - let rs = 0; - let rt = 0; +class UncondBranch : + InstSE<(outs), (ins brtarget:$offset), !strconcat(opstr, "\t$offset"), + [(br bb:$offset)], IIBranch, FrmI> { let isBranch = 1; let isTerminator = 1; let isBarrier = 1; @@ -979,7 +977,7 @@ def SC_P8 : SCBase<0x38, "sc", CPURegs, mem64>, def J : JumpFJ<0x02, jmptarget, "j", br, bb>, Requires<[RelocStatic, HasStdEnc]>, IsBranch; def JR : IndirectBranch; -def B : UncondBranch<0x04, "b">; +def B : UncondBranch<"b">, B_FM; def BEQ : CBranch<"beq", seteq, CPURegs>, BEQ_FM<4>; def BNE : CBranch<"bne", setne, CPURegs>, BEQ_FM<5>; def BGEZ : CBranchZero<"bgez", setge, CPURegs>, BGEZ_FM<1, 1>;