Support for microMIPS DIV instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190745 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Zoran Jovanovic 2013-09-14 07:15:21 +00:00
parent 47b33528d1
commit ab48d10eff
5 changed files with 23 additions and 1 deletions

View File

@ -69,6 +69,10 @@ let DecoderNamespace = "MicroMips", Predicates = [InMicroMips] in {
MULT_FM_MM<0x22c>;
def MULTu_MM : MMRel, Mult<"multu", IIImul, GPR32Opnd, [HI0, LO0]>,
MULT_FM_MM<0x26c>;
def SDIV_MM : MMRel, Div<"div", IIIdiv, GPR32Opnd, [HI0, LO0]>,
MULT_FM_MM<0x2ac>;
def UDIV_MM : MMRel, Div<"divu", IIIdiv, GPR32Opnd, [HI0, LO0]>,
MULT_FM_MM<0x2ec>;
/// Shift Instructions
def SLL_MM : MMRel, shift_rotate_imm<"sll", uimm5, GPR32Opnd>,

View File

@ -681,7 +681,7 @@ class MAddSubPseudo<Instruction RealInst, SDPatternOperator OpNode>
class Div<string opstr, InstrItinClass itin, RegisterOperand RO,
list<Register> DefRegs> :
InstSE<(outs), (ins RO:$rs, RO:$rt), !strconcat(opstr, "\t$$zero, $rs, $rt"),
[], itin, FrmR> {
[], itin, FrmR, opstr> {
let Defs = DefRegs;
}

View File

@ -88,6 +88,12 @@
# CHECK: multu $9, $7
0x00 0xe9 0x9b 0x3c
# CHECK-EB: div $zero, $9, $7
0x00 0xe9 0xab 0x3c
# CHECK-EB: divu $zero, $9, $7
0x00 0xe9 0xbb 0x3c
# CHECK: sll $4, $3, 7
0x00 0x83 0x38 0x00

View File

@ -88,6 +88,12 @@
# CHECK: multu $9, $7
0xe9 0x00 0x3c 0x9b
# CHECK: div $zero, $9, $7
0xe9 0x00 0x3c 0xab
# CHECK: divu $zero, $9, $7
0xe9 0x00 0x3c 0xbb
# CHECK: sll $4, $3, 7
0x83 0x00 0x00 0x38

View File

@ -36,6 +36,8 @@
# CHECK-EL: mul $9, $6, $7 # encoding: [0xe6,0x00,0x10,0x4a]
# CHECK-EL: mult $9, $7 # encoding: [0xe9,0x00,0x3c,0x8b]
# CHECK-EL: multu $9, $7 # encoding: [0xe9,0x00,0x3c,0x9b]
# CHECK-EL: div $zero, $9, $7 # encoding: [0xe9,0x00,0x3c,0xab]
# CHECK-EL: divu $zero, $9, $7 # encoding: [0xe9,0x00,0x3c,0xbb]
#------------------------------------------------------------------------------
# Big endian
#------------------------------------------------------------------------------
@ -68,6 +70,8 @@
# CHECK-EB: mul $9, $6, $7 # encoding: [0x00,0xe6,0x4a,0x10]
# CHECK-EB: mult $9, $7 # encoding: [0x00,0xe9,0x8b,0x3c]
# CHECK-EB: multu $9, $7 # encoding: [0x00,0xe9,0x9b,0x3c]
# CHECK-EB: div $zero, $9, $7 # encoding: [0x00,0xe9,0xab,0x3c]
# CHECK-EB: divu $zero, $9, $7 # encoding: [0x00,0xe9,0xbb,0x3c]
add $9, $6, $7
add $9, $6, 17767
addu $9, $6, -15001
@ -97,3 +101,5 @@
mul $9, $6, $7
mult $9, $7
multu $9, $7
div $0, $9, $7
divu $0, $9, $7