mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-06 20:32:19 +00:00
[mips] Refactor instructions which copy from and to HI/LO registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170939 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2a732ec272
commit
7de001b97e
@ -186,10 +186,10 @@ def DMULTu : Mult64<0x1d, "dmultu", IIImul>;
|
||||
def DSDIV : Div64<MipsDivRem, 0x1e, "ddiv", IIIdiv>;
|
||||
def DUDIV : Div64<MipsDivRemU, 0x1f, "ddivu", IIIdiv>;
|
||||
|
||||
def MTHI64 : MoveToLOHI<0x11, "mthi", CPU64Regs, [HI64]>;
|
||||
def MTLO64 : MoveToLOHI<0x13, "mtlo", CPU64Regs, [LO64]>;
|
||||
def MFHI64 : MoveFromLOHI<0x10, "mfhi", CPU64Regs, [HI64]>;
|
||||
def MFLO64 : MoveFromLOHI<0x12, "mflo", CPU64Regs, [LO64]>;
|
||||
def MTHI64 : MoveToLOHI<"mthi", CPU64Regs, [HI64]>, MTLO_FM<0x11>;
|
||||
def MTLO64 : MoveToLOHI<"mtlo", CPU64Regs, [LO64]>, MTLO_FM<0x13>;
|
||||
def MFHI64 : MoveFromLOHI<"mfhi", CPU64Regs, [HI64]>, MFLO_FM<0x10>;
|
||||
def MFLO64 : MoveFromLOHI<"mflo", CPU64Regs, [LO64]>, MFLO_FM<0x12>;
|
||||
|
||||
/// Sign Ext In Register Instructions.
|
||||
def SEB64 : SignExtInReg<0x10, "seb", i8, CPU64Regs>;
|
||||
|
@ -303,6 +303,29 @@ class SLTI_FM<bits<6> op> {
|
||||
let Inst{15-0} = imm16;
|
||||
}
|
||||
|
||||
class MFLO_FM<bits<6> funct> {
|
||||
bits<5> rd;
|
||||
|
||||
bits<32> Inst;
|
||||
|
||||
let Inst{31-26} = 0;
|
||||
let Inst{25-16} = 0;
|
||||
let Inst{15-11} = rd;
|
||||
let Inst{10-6} = 0;
|
||||
let Inst{5-0} = funct;
|
||||
}
|
||||
|
||||
class MTLO_FM<bits<6> funct> {
|
||||
bits<5> rs;
|
||||
|
||||
bits<32> Inst;
|
||||
|
||||
let Inst{31-26} = 0;
|
||||
let Inst{25-21} = rs;
|
||||
let Inst{20-6} = 0;
|
||||
let Inst{5-0} = funct;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// FLOATING POINT INSTRUCTION FORMATS
|
||||
|
@ -665,24 +665,14 @@ class Div32<SDNode op, bits<6> func, string instr_asm, InstrItinClass itin>:
|
||||
Div<op, func, instr_asm, itin, CPURegs, [HI, LO]>;
|
||||
|
||||
// Move from Hi/Lo
|
||||
class MoveFromLOHI<bits<6> func, string instr_asm, RegisterClass RC,
|
||||
list<Register> UseRegs>:
|
||||
FR<0x00, func, (outs RC:$rd), (ins),
|
||||
!strconcat(instr_asm, "\t$rd"), [], IIHiLo> {
|
||||
let rs = 0;
|
||||
let rt = 0;
|
||||
let shamt = 0;
|
||||
class MoveFromLOHI<string opstr, RegisterClass RC, list<Register> UseRegs>:
|
||||
InstSE<(outs RC:$rd), (ins), !strconcat(opstr, "\t$rd"), [], IIHiLo, FrmR> {
|
||||
let Uses = UseRegs;
|
||||
let neverHasSideEffects = 1;
|
||||
}
|
||||
|
||||
class MoveToLOHI<bits<6> func, string instr_asm, RegisterClass RC,
|
||||
list<Register> DefRegs>:
|
||||
FR<0x00, func, (outs), (ins RC:$rs),
|
||||
!strconcat(instr_asm, "\t$rs"), [], IIHiLo> {
|
||||
let rt = 0;
|
||||
let rd = 0;
|
||||
let shamt = 0;
|
||||
class MoveToLOHI<string opstr, RegisterClass RC, list<Register> DefRegs>:
|
||||
InstSE<(outs), (ins RC:$rs), !strconcat(opstr, "\t$rs"), [], IIHiLo, FrmR> {
|
||||
let Defs = DefRegs;
|
||||
let neverHasSideEffects = 1;
|
||||
}
|
||||
@ -970,10 +960,10 @@ def MULTu : Mult32<0x19, "multu", IIImul>;
|
||||
def SDIV : Div32<MipsDivRem, 0x1a, "div", IIIdiv>;
|
||||
def UDIV : Div32<MipsDivRemU, 0x1b, "divu", IIIdiv>;
|
||||
|
||||
def MTHI : MoveToLOHI<0x11, "mthi", CPURegs, [HI]>;
|
||||
def MTLO : MoveToLOHI<0x13, "mtlo", CPURegs, [LO]>;
|
||||
def MFHI : MoveFromLOHI<0x10, "mfhi", CPURegs, [HI]>;
|
||||
def MFLO : MoveFromLOHI<0x12, "mflo", CPURegs, [LO]>;
|
||||
def MTHI : MoveToLOHI<"mthi", CPURegs, [HI]>, MTLO_FM<0x11>;
|
||||
def MTLO : MoveToLOHI<"mtlo", CPURegs, [LO]>, MTLO_FM<0x13>;
|
||||
def MFHI : MoveFromLOHI<"mfhi", CPURegs, [HI]>, MFLO_FM<0x10>;
|
||||
def MFLO : MoveFromLOHI<"mflo", CPURegs, [LO]>, MFLO_FM<0x12>;
|
||||
|
||||
/// Sign Ext In Register Instructions.
|
||||
def SEB : SignExtInReg<0x10, "seb", i8, CPURegs>;
|
||||
|
Loading…
Reference in New Issue
Block a user