From f1fddcd9e01ceb38ee7f2951f9e109cccb601654 Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Mon, 17 Oct 2011 18:21:24 +0000 Subject: Redefine multiply and divide instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142211 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Mips/Mips64InstrInfo.td | 19 ++++++------------- lib/Target/Mips/MipsInstrInfo.td | 32 ++++++++++++++++++++------------ 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/lib/Target/Mips/Mips64InstrInfo.td b/lib/Target/Mips/Mips64InstrInfo.td index 29cc76c..f2eb700 100644 --- a/lib/Target/Mips/Mips64InstrInfo.td +++ b/lib/Target/Mips/Mips64InstrInfo.td @@ -52,17 +52,10 @@ class shift_rotate_imm64_32 func, bits<5> isRotate, string instr_asm, CPU64Regs>; // Mul, Div -let Defs = [HI64, LO64] in { - let isCommutable = 1 in - class Mul64 func, string instr_asm, InstrItinClass itin>: - FR<0x00, func, (outs), (ins CPU64Regs:$a, CPU64Regs:$b), - !strconcat(instr_asm, "\t$a, $b"), [], itin>; - - class Div64 func, string instr_asm, InstrItinClass itin>: - FR<0x00, func, (outs), (ins CPU64Regs:$a, CPU64Regs:$b), - !strconcat(instr_asm, "\t$$zero, $a, $b"), - [(op CPU64Regs:$a, CPU64Regs:$b)], itin>; -} +class Mult64 func, string instr_asm, InstrItinClass itin>: + Mult; +class Div64 func, string instr_asm, InstrItinClass itin>: + Div; // Move from Hi/Lo let shamt = 0 in { @@ -159,8 +152,8 @@ def BLEZ64 : CBranchZero<0x07, 0, "blez", setle, CPU64Regs>; def BLTZ64 : CBranchZero<0x01, 0, "bltz", setlt, CPU64Regs>; /// Multiply and Divide Instructions. -def DMULT : Mul64<0x1c, "dmult", IIImul>; -def DMULTu : Mul64<0x1d, "dmultu", IIImul>; +def DMULT : Mult64<0x1c, "dmult", IIImul>; +def DMULTu : Mult64<0x1d, "dmultu", IIImul>; def DSDIV : Div64; def DUDIV : Div64; diff --git a/lib/Target/Mips/MipsInstrInfo.td b/lib/Target/Mips/MipsInstrInfo.td index 7588605..537d97b 100644 --- a/lib/Target/Mips/MipsInstrInfo.td +++ b/lib/Target/Mips/MipsInstrInfo.td @@ -461,24 +461,32 @@ let isCall=1, hasDelaySlot=1, } // Mul, Div -class Mul func, string instr_asm, InstrItinClass itin>: - FR<0x00, func, (outs), (ins CPURegs:$rs, CPURegs:$rt), +class Mult func, string instr_asm, InstrItinClass itin, + RegisterClass RC, list DefRegs>: + FR<0x00, func, (outs), (ins RC:$rs, RC:$rt), !strconcat(instr_asm, "\t$rs, $rt"), [], itin> { let rd = 0; let shamt = 0; let isCommutable = 1; - let Defs = [HI, LO]; + let Defs = DefRegs; } -class Div func, string instr_asm, InstrItinClass itin>: - FR<0x00, func, (outs), (ins CPURegs:$rs, CPURegs:$rt), - !strconcat(instr_asm, "\t$$zero, $rs, $rt"), - [(op CPURegs:$rs, CPURegs:$rt)], itin> { +class Mult32 func, string instr_asm, InstrItinClass itin>: + Mult; + +class Div func, string instr_asm, InstrItinClass itin, + RegisterClass RC, list DefRegs>: + FR<0x00, func, (outs), (ins RC:$rs, RC:$rt), + !strconcat(instr_asm, "\t$$zero, $rs, $rt"), + [(op RC:$rs, RC:$rt)], itin> { let rd = 0; let shamt = 0; - let Defs = [HI, LO]; + let Defs = DefRegs; } +class Div32 func, string instr_asm, InstrItinClass itin>: + Div; + // Move from Hi/Lo class MoveFromLOHI func, string instr_asm>: FR<0x00, func, (outs CPURegs:$rd), (ins), @@ -726,10 +734,10 @@ let isReturn=1, isTerminator=1, hasDelaySlot=1, "jr\t$target", [(MipsRet CPURegs:$target)], IIBranch>; /// Multiply and Divide Instructions. -def MULT : Mul<0x18, "mult", IIImul>; -def MULTu : Mul<0x19, "multu", IIImul>; -def SDIV : Div; -def UDIV : Div; +def MULT : Mult32<0x18, "mult", IIImul>; +def MULTu : Mult32<0x19, "multu", IIImul>; +def SDIV : Div32; +def UDIV : Div32; let Defs = [HI] in def MTHI : MoveToLOHI<0x11, "mthi">; -- cgit v1.1