Index: lib/Target/Mips/AsmParser/MipsAsmParser.cpp =================================================================== --- lib/Target/Mips/AsmParser/MipsAsmParser.cpp +++ lib/Target/Mips/AsmParser/MipsAsmParser.cpp @@ -216,9 +216,9 @@ bool expandCondBranches(MCInst &Inst, SMLoc IDLoc, SmallVectorImpl &Instructions); - bool expandDiv(MCInst &Inst, SMLoc IDLoc, - SmallVectorImpl &Instructions, const bool IsMips64, - const bool Signed); + bool expandDivRem(MCInst &Inst, SMLoc IDLoc, + SmallVectorImpl &Instructions, const bool IsMips64, + const bool Signed); bool expandTrunc(MCInst &Inst, bool IsDouble, bool Is64FPU, SMLoc IDLoc, SmallVectorImpl &Instructions); @@ -2047,20 +2047,28 @@ : MER_Success; case Mips::SDivMacro: case Mips::SDivIMacro: - return expandDiv(Inst, IDLoc, Instructions, false, true) ? MER_Fail - : MER_Success; + case Mips::SRemMacro: + case Mips::SRemIMacro: + return expandDivRem(Inst, IDLoc, Instructions, false, true) ? MER_Fail + : MER_Success; case Mips::DSDivMacro: case Mips::DSDivIMacro: - return expandDiv(Inst, IDLoc, Instructions, true, true) ? MER_Fail - : MER_Success; + case Mips::DSRemMacro: + case Mips::DSRemIMacro: + return expandDivRem(Inst, IDLoc, Instructions, true, true) ? MER_Fail + : MER_Success; case Mips::UDivMacro: case Mips::UDivIMacro: - return expandDiv(Inst, IDLoc, Instructions, false, false) ? MER_Fail - : MER_Success; + case Mips::URemMacro: + case Mips::URemIMacro: + return expandDivRem(Inst, IDLoc, Instructions, false, false) ? MER_Fail + : MER_Success; case Mips::DUDivMacro: case Mips::DUDivIMacro: - return expandDiv(Inst, IDLoc, Instructions, true, false) ? MER_Fail - : MER_Success; + case Mips::DURemMacro: + case Mips::DURemIMacro: + return expandDivRem(Inst, IDLoc, Instructions, true, false) ? MER_Fail + : MER_Success; case Mips::PseudoTRUNC_W_S: return expandTrunc(Inst, false, false, IDLoc, Instructions) ? MER_Fail @@ -2958,9 +2966,9 @@ return false; } -bool MipsAsmParser::expandDiv(MCInst &Inst, SMLoc IDLoc, - SmallVectorImpl &Instructions, - const bool IsMips64, const bool Signed) { +bool MipsAsmParser::expandDivRem(MCInst &Inst, SMLoc IDLoc, + SmallVectorImpl &Instructions, + const bool IsMips64, const bool Signed) { if (hasMips32r6()) { Error(IDLoc, "instruction not supported on mips32r6 or mips64r6"); return false; @@ -3003,6 +3011,22 @@ bool UseTraps = useTraps(); + unsigned Opcode = Inst.getOpcode(); + bool isDiv = Opcode == Mips::SDivMacro || Opcode == Mips::SDivIMacro || + Opcode == Mips::UDivMacro || Opcode == Mips::UDivIMacro || + Opcode == Mips::DSDivMacro || Opcode == Mips::DSDivIMacro || + Opcode == Mips::DUDivMacro || Opcode == Mips::DUDivIMacro; + + bool isRem = Opcode == Mips::SRemMacro || Opcode == Mips::SRemIMacro || + Opcode == Mips::URemMacro || Opcode == Mips::URemIMacro || + Opcode == Mips::DSRemMacro || Opcode == Mips::DSRemIMacro || + Opcode == Mips::DURemMacro || Opcode == Mips::DURemIMacro; + + if (isRem && (RdReg == Mips::ZERO || RdReg == Mips::ZERO_64)) { + emitRR(DivOp, RsReg, RtReg, IDLoc, Instructions); + return false; + } + if (RtOp.isImm()) { unsigned ATReg = getATReg(IDLoc); if (!ATReg) @@ -3020,21 +3044,23 @@ return false; } - if (ImmValue == 1) { - emitRRR(Mips::ADDu, RdReg, RsReg, Mips::ZERO, IDLoc, Instructions); + if (isRem && (ImmValue == 1 || (Signed && (ImmValue == -1)))) { + emitRRR(Mips::ADDu, RdReg, ZeroReg, ZeroReg, IDLoc, Instructions); return false; - } else if (Signed && ImmValue == -1) { - emitRRR(SubOp, RdReg, Mips::ZERO, RsReg, IDLoc, Instructions); + } else if (isDiv && ImmValue == 1) { + emitRRR(Mips::ADDu, RdReg, RsReg, Mips::ZERO, IDLoc, Instructions); return false; - } else { - if (loadImmediate(ImmValue, ATReg, Mips::NoRegister, true, false, - Inst.getLoc(), Instructions)) - return true; - emitRR(DivOp, RsReg, ATReg, IDLoc, Instructions); - emitR(Mips::MFLO, RdReg, IDLoc, Instructions); + } else if (isDiv && Signed && ImmValue == -1) { + emitRRR(SubOp, RdReg, ZeroReg, RsReg, IDLoc, Instructions); return false; } - return true; + + if (loadImmediate(ImmValue, ATReg, Mips::NoRegister, true, false, + Inst.getLoc(), Instructions)) + return true; + emitRR(DivOp, RsReg, ATReg, IDLoc, Instructions); + emitR(isDiv ? Mips::MFLO : Mips::MFHI, RdReg, IDLoc, Instructions); + return false; } if (RsReg == Mips::ZERO || RsReg == Mips::ZERO_64) { @@ -3051,8 +3077,18 @@ return false; } } else { - emitRR(DivOp, RsReg, RtReg, IDLoc, Instructions); - return false; + if (isDiv) { + emitRR(DivOp, RsReg, RtReg, IDLoc, Instructions); + return false; + } else if (isRem && Signed) { + if (UseTraps) { + emitRRI(Mips::TEQ, RtReg, ZeroReg, 0x7, IDLoc, Instructions); + return false; + } + + emitII(Mips::BREAK, 0x7, 0, IDLoc, Instructions); + return false; + } } } @@ -3091,7 +3127,7 @@ emitII(Mips::BREAK, 0x7, 0, IDLoc, Instructions); if (!Signed) { - emitR(Mips::MFLO, RdReg, IDLoc, Instructions); + emitR(isDiv ? Mips::MFLO : Mips::MFHI, RdReg, IDLoc, Instructions); return false; } @@ -3116,10 +3152,13 @@ else { // Branch to the mflo instruction. emitRRI(Mips::BNE, RsReg, ATReg, BranchTargetNoTraps, IDLoc, Instructions); - emitRRI(Mips::SLL, ZeroReg, ZeroReg, 0, IDLoc, Instructions); + if (isDiv) + emitRRI(Mips::SLL, ZeroReg, ZeroReg, 0, IDLoc, Instructions); + else + createNop(hasShortDelaySlot(Inst.getOpcode()), IDLoc, Instructions); emitII(Mips::BREAK, 0x6, 0, IDLoc, Instructions); } - emitR(Mips::MFLO, RdReg, IDLoc, Instructions); + emitR(isDiv ? Mips::MFLO : Mips::MFHI, RdReg, IDLoc, Instructions); return false; } Index: lib/Target/Mips/MipsInstrInfo.td =================================================================== --- lib/Target/Mips/MipsInstrInfo.td +++ lib/Target/Mips/MipsInstrInfo.td @@ -2086,20 +2086,20 @@ ISA_MIPS1_NOT_32R6_64R6; def DSDivMacro : MipsAsmPseudoInst<(outs GPR32Opnd:$rd), - (ins GPR32Opnd:$rs, GPR32Opnd:$rt), - "ddiv\t$rd, $rs, $rt">, + (ins GPR32Opnd:$rs, GPR32Opnd:$rt), + "ddiv\t$rd, $rs, $rt">, ISA_MIPS64_NOT_64R6; def DSDivIMacro : MipsAsmPseudoInst<(outs GPR32Opnd:$rd), - (ins GPR32Opnd:$rs, simm16:$imm), - "ddiv\t$rd, $rs, $imm">, + (ins GPR32Opnd:$rs, simm16:$imm), + "ddiv\t$rd, $rs, $imm">, ISA_MIPS64_NOT_64R6; def DUDivMacro : MipsAsmPseudoInst<(outs GPR32Opnd:$rd), - (ins GPR32Opnd:$rs, GPR32Opnd:$rt), - "ddivu\t$rd, $rs, $rt">, + (ins GPR32Opnd:$rs, GPR32Opnd:$rt), + "ddivu\t$rd, $rs, $rt">, ISA_MIPS64_NOT_64R6; def DUDivIMacro : MipsAsmPseudoInst<(outs GPR32Opnd:$rd), - (ins GPR32Opnd:$rs, simm16:$imm), - "ddivu\t$rd, $rs, $imm">, + (ins GPR32Opnd:$rs, simm16:$imm), + "ddivu\t$rd, $rs, $imm">, ISA_MIPS64_NOT_64R6; def : MipsInstAlias<"ddiv $rt, $rs", (DSDivMacro GPR32Opnd:$rt, GPR32Opnd:$rt, GPR32Opnd:$rs), 0>; @@ -2111,6 +2111,58 @@ GPR32Opnd:$rd, simm16:$imm), 0>, ISA_MIPS64_NOT_64R6; +def SRemMacro : MipsAsmPseudoInst<(outs GPR32Opnd:$rd), + (ins GPR32Opnd:$rs, GPR32Opnd:$rt), + "rem\t$rd, $rs, $rt">, + ISA_MIPS1_NOT_32R6_64R6; +def SRemIMacro : MipsAsmPseudoInst<(outs GPR32Opnd:$rd), + (ins GPR32Opnd:$rs, simm16:$imm), + "rem\t$rd, $rs, $imm">, + ISA_MIPS1_NOT_32R6_64R6; +def URemMacro : MipsAsmPseudoInst<(outs GPR32Opnd:$rd), + (ins GPR32Opnd:$rs, GPR32Opnd:$rt), + "remu\t$rd, $rs, $rt">, + ISA_MIPS1_NOT_32R6_64R6; +def URemIMacro : MipsAsmPseudoInst<(outs GPR32Opnd:$rd), + (ins GPR32Opnd:$rs, simm16:$imm), + "remu\t$rd, $rs, $imm">, + ISA_MIPS1_NOT_32R6_64R6; +def : MipsInstAlias<"rem $rt, $rs", (SRemMacro GPR32Opnd:$rt, GPR32Opnd:$rt, + GPR32Opnd:$rs), 0>; +def : MipsInstAlias<"rem $rd, $imm", (SRemIMacro GPR32Opnd:$rd, GPR32Opnd:$rd, + simm16:$imm), 0>, + ISA_MIPS1_NOT_32R6_64R6; +def : MipsInstAlias<"remu $rt, $rs", (URemMacro GPR32Opnd:$rt, GPR32Opnd:$rt, + GPR32Opnd:$rs), 0>; +def : MipsInstAlias<"remu $rd, $imm", (URemIMacro GPR32Opnd:$rd, GPR32Opnd:$rd, + simm16:$imm), 0>, + ISA_MIPS1_NOT_32R6_64R6; +def DSRemMacro : MipsAsmPseudoInst<(outs GPR32Opnd:$rd), + (ins GPR32Opnd:$rs, GPR32Opnd:$rt), + "drem\t$rd, $rs, $rt">, + ISA_MIPS64_NOT_64R6; +def DSRemIMacro : MipsAsmPseudoInst<(outs GPR32Opnd:$rd), + (ins GPR32Opnd:$rs, simm16:$imm), + "drem\t$rd, $rs, $imm">, + ISA_MIPS64_NOT_64R6; +def DURemMacro : MipsAsmPseudoInst<(outs GPR32Opnd:$rd), + (ins GPR32Opnd:$rs, GPR32Opnd:$rt), + "dremu\t$rd, $rs, $rt">, + ISA_MIPS64_NOT_64R6; +def DURemIMacro : MipsAsmPseudoInst<(outs GPR32Opnd:$rd), + (ins GPR32Opnd:$rs, simm16:$imm), + "dremu\t$rd, $rs, $imm">, + ISA_MIPS64_NOT_64R6; +def : MipsInstAlias<"drem $rt, $rs", (DSRemMacro GPR32Opnd:$rt, GPR32Opnd:$rt, + GPR32Opnd:$rs), 0>; +def : MipsInstAlias<"drem $rd, $imm", (DSRemIMacro GPR32Opnd:$rd, GPR32Opnd:$rd, + simm16:$imm), 0>, ISA_MIPS64_NOT_64R6; +def : MipsInstAlias<"dremu $rt, $rs", (DURemMacro GPR32Opnd:$rt, GPR32Opnd:$rt, + GPR32Opnd:$rs), 0>; +def : MipsInstAlias<"dremu $rd, $imm", (DURemIMacro GPR32Opnd:$rd, + GPR32Opnd:$rd, simm16:$imm), 0>, + ISA_MIPS64_NOT_64R6; + def Ulh : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins mem:$addr), "ulh\t$rt, $addr">; //, ISA_MIPS1_NOT_32R6_64R6; Index: test/MC/Mips/macro-drem.s =================================================================== --- /dev/null +++ test/MC/Mips/macro-drem.s @@ -0,0 +1,232 @@ +# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips64 | \ +# RUN: FileCheck %s --check-prefix=CHECK-NOTRAP +# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips64 \ +# RUN: -mattr=+use-tcc-in-div | FileCheck %s --check-prefix=CHECK-TRAP + + drem $4,$5 +# CHECK-NOTRAP: bne $5, $zero, 8 # encoding: [0x02,0x00,0xa0,0x14] +# CHECK-NOTRAP: ddiv $zero, $4, $5 # encoding: [0x1e,0x00,0x85,0x00] +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24] +# CHECK-NOTRAP: bne $5, $1, 20 # encoding: [0x05,0x00,0xa1,0x14] +# CHECK-NOTRAP: addiu $1, $zero, 1 # encoding: [0x01,0x00,0x01,0x24] +# CHECK-NOTRAP: dsll32 $1, $1, 31 # encoding: [0xfc,0x0f,0x01,0x00] +# CHECK-NOTRAP: bne $4, $1, 8 # encoding: [0x02,0x00,0x81,0x14] +# CHECK-NOTRAP: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-NOTRAP: break 6 # encoding: [0x0d,0x00,0x06,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + drem $4,$0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] + + drem $4,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] + + drem $0,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] + + drem $4,1 +# CHECK-NOTRAP: addu $4, $zero, $zero # encoding: [0x21,0x20,0x00,0x00] + + drem $4,-1 +# CHECK-NOTRAP: addu $4, $zero, $zero # encoding: [0x21,0x20,0x00,0x00] + + drem $4,2 +# CHECK-NOTRAP: addiu $1, $zero, 2 # encoding: [0x02,0x00,0x01,0x24] +# CHECK-NOTRAP: ddiv $zero, $4, $1 # encoding: [0x1e,0x00,0x81,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + drem $4,0x10000 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-NOTRAP: ddiv $zero, $4, $1 # encoding: [0x1e,0x00,0x81,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + drem $4,0x1a5a5 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-NOTRAP: ori $1, $1, 42405 # encoding: [0xa5,0xa5,0x21,0x34] +# CHECK-NOTRAP: ddiv $zero, $4, $1 # encoding: [0x1e,0x00,0x81,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + drem $4,0x8000 +# CHECK-NOTRAP: ori $1, $zero, 32768 # encoding: [0x00,0x80,0x01,0x34] +# CHECK-NOTRAP: ddiv $zero, $4, $1 # encoding: [0x1e,0x00,0x81,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + drem $4,-0x8000 +# CHECK-NOTRAP: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24] +# CHECK-NOTRAP: ddiv $zero, $4, $1 # encoding: [0x1e,0x00,0x81,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + drem $4,$5,$6 +# CHECK-NOTRAP: bne $6, $zero, 8 # encoding: [0x02,0x00,0xc0,0x14] +# CHECK-NOTRAP: ddiv $zero, $5, $6 # encoding: [0x1e,0x00,0xa6,0x00] +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24] +# CHECK-NOTRAP: bne $6, $1, 20 # encoding: [0x05,0x00,0xc1,0x14] +# CHECK-NOTRAP: addiu $1, $zero, 1 # encoding: [0x01,0x00,0x01,0x24] +# CHECK-NOTRAP: dsll32 $1, $1, 31 # encoding: [0xfc,0x0f,0x01,0x00] +# CHECK-NOTRAP: bne $5, $1, 8 # encoding: [0x02,0x00,0xa1,0x14] +# CHECK-NOTRAP: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-NOTRAP: break 6 # encoding: [0x0d,0x00,0x06,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + drem $4,$5,$0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] + + drem $4,$0,$0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] + + drem $0,$5,$4 +# CHECK-NOTRAP: ddiv $zero, $5, $4 # encoding: [0x1e,0x00,0xa4,0x00] + + drem $4,$5,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] + + drem $4,$0,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] + + drem $0,$4,$5 +# CHECK-NOTRAP: ddiv $zero, $4, $5 # encoding: [0x1e,0x00,0x85,0x00] + + drem $4,$5,1 +# CHECK-NOTRAP: addu $4, $zero, $zero # encoding: [0x21,0x20,0x00,0x00] + + drem $4,$5,-1 +# CHECK-NOTRAP: addu $4, $zero, $zero # encoding: [0x21,0x20,0x00,0x00] + + drem $4,$5,2 +# CHECK-NOTRAP: addiu $1, $zero, 2 # encoding: [0x02,0x00,0x01,0x24] +# CHECK-NOTRAP: ddiv $zero, $5, $1 # encoding: [0x1e,0x00,0xa1,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + drem $4,$5,0x10000 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-NOTRAP: ddiv $zero, $5, $1 # encoding: [0x1e,0x00,0xa1,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + drem $4,$5,0x1a5a5 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-NOTRAP: ori $1, $1, 42405 # encoding: [0xa5,0xa5,0x21,0x34] +# CHECK-NOTRAP: ddiv $zero, $5, $1 # encoding: [0x1e,0x00,0xa1,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + drem $4,$5,0x8000 +# CHECK-NOTRAP: ori $1, $zero, 32768 # encoding: [0x00,0x80,0x01,0x34] +# CHECK-NOTRAP: ddiv $zero, $5, $1 # encoding: [0x1e,0x00,0xa1,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + drem $4,$5,-0x8000 +# CHECK-NOTRAP: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24] +# CHECK-NOTRAP: ddiv $zero, $5, $1 # encoding: [0x1e,0x00,0xa1,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + drem $4,$5 +# CHECK-TRAP: teq $5, $zero, 7 # encoding: [0xf4,0x01,0xa0,0x00] +# CHECK-TRAP: ddiv $zero, $4, $5 # encoding: [0x1e,0x00,0x85,0x00] +# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24] +# CHECK-TRAP: bne $5, $1, 12 # encoding: [0x03,0x00,0xa1,0x14] +# CHECK-TRAP: addiu $1, $zero, 1 # encoding: [0x01,0x00,0x01,0x24] +# CHECK-TRAP: dsll32 $1, $1, 31 # encoding: [0xfc,0x0f,0x01,0x00] +# CHECK-TRAP: teq $4, $1, 6 # encoding: [0xb4,0x01,0x81,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + drem $4,$0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + drem $4,0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + drem $0,0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + drem $4,1 +# CHECK-TRAP: addu $4, $zero, $zero # encoding: [0x21,0x20,0x00,0x00] + + drem $4,-1 +# CHECK-TRAP: addu $4, $zero, $zero # encoding: [0x21,0x20,0x00,0x00] + + drem $4,2 +# CHECK-TRAP: addiu $1, $zero, 2 # encoding: [0x02,0x00,0x01,0x24] +# CHECK-TRAP: ddiv $zero, $4, $1 # encoding: [0x1e,0x00,0x81,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + drem $4,0x10000 +# CHECK-TRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-TRAP: ddiv $zero, $4, $1 # encoding: [0x1e,0x00,0x81,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + drem $4,0x1a5a5 +# CHECK-TRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-TRAP: ori $1, $1, 42405 # encoding: [0xa5,0xa5,0x21,0x34] +# CHECK-TRAP: ddiv $zero, $4, $1 # encoding: [0x1e,0x00,0x81,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + drem $4,0x8000 +# CHECK-TRAP: ori $1, $zero, 32768 # encoding: [0x00,0x80,0x01,0x34] +# CHECK-TRAP: ddiv $zero, $4, $1 # encoding: [0x1e,0x00,0x81,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + drem $4,-0x8000 +# CHECK-TRAP: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24] +# CHECK-TRAP: ddiv $zero, $4, $1 # encoding: [0x1e,0x00,0x81,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + drem $4,$5,$6 +# CHECK-TRAP: teq $6, $zero, 7 # encoding: [0xf4,0x01,0xc0,0x00] +# CHECK-TRAP: ddiv $zero, $5, $6 # encoding: [0x1e,0x00,0xa6,0x00] +# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24] +# CHECK-TRAP: bne $6, $1, 12 # encoding: [0x03,0x00,0xc1,0x14] +# CHECK-TRAP: addiu $1, $zero, 1 # encoding: [0x01,0x00,0x01,0x24] +# CHECK-TRAP: dsll32 $1, $1, 31 # encoding: [0xfc,0x0f,0x01,0x00] +# CHECK-TRAP: teq $5, $1, 6 # encoding: [0xb4,0x01,0xa1,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + drem $4,$5,$0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + drem $4,$0,$0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + drem $0,$5,$4 +# CHECK-TRAP: ddiv $zero, $5, $4 # encoding: [0x1e,0x00,0xa4,0x00] + + drem $4,$5,0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + drem $4,$0,0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + drem $0,$4,$5 +# CHECK-TRAP: ddiv $zero, $4, $5 # encoding: [0x1e,0x00,0x85,0x00] + + drem $4,$5,1 +# CHECK-TRAP: addu $4, $zero, $zero # encoding: [0x21,0x20,0x00,0x00] + + drem $4,$5,-1 +# CHECK-TRAP: addu $4, $zero, $zero # encoding: [0x21,0x20,0x00,0x00] + + drem $4,$5,2 +# CHECK-TRAP: addiu $1, $zero, 2 # encoding: [0x02,0x00,0x01,0x24] +# CHECK-TRAP: ddiv $zero, $5, $1 # encoding: [0x1e,0x00,0xa1,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + drem $4,$5,0x10000 +# CHECK-TRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-TRAP: ddiv $zero, $5, $1 # encoding: [0x1e,0x00,0xa1,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + drem $4,$5,0x1a5a5 +# CHECK-TRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-TRAP: ori $1, $1, 42405 # encoding: [0xa5,0xa5,0x21,0x34] +# CHECK-TRAP: ddiv $zero, $5, $1 # encoding: [0x1e,0x00,0xa1,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + drem $4,$5,0x8000 +# CHECK-TRAP: ori $1, $zero, 32768 # encoding: [0x00,0x80,0x01,0x34] +# CHECK-TRAP: ddiv $zero, $5, $1 # encoding: [0x1e,0x00,0xa1,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + drem $4,$5,-0x8000 +# CHECK-TRAP: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24] +# CHECK-TRAP: ddiv $zero, $5, $1 # encoding: [0x1e,0x00,0xa1,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] Index: test/MC/Mips/macro-dremu.s =================================================================== --- /dev/null +++ test/MC/Mips/macro-dremu.s @@ -0,0 +1,231 @@ +# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips64 | \ +# RUN: FileCheck %s --check-prefix=CHECK-NOTRAP +# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips64 \ +# RUN: -mattr=+use-tcc-in-div | FileCheck %s --check-prefix=CHECK-TRAP + + dremu $4,$5 +# CHECK-NOTRAP: bne $5, $zero, 8 # encoding: [0x02,0x00,0xa0,0x14] +# CHECK-NOTRAP: ddivu $zero, $4, $5 # encoding: [0x1f,0x00,0x85,0x00] +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,$0 +# CHECK-NOTRAP: bne $zero, $zero, 8 # encoding: [0x02,0x00,0x00,0x14] +# CHECK-NOTRAP: ddivu $zero, $4, $zero # encoding: [0x1f,0x00,0x80,0x00] +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] + + dremu $0,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] + + dremu $4,1 +# CHECK-NOTRAP: addu $4, $zero, $zero # encoding: [0x21,0x20,0x00,0x00] + + dremu $4,2 +# CHECK-NOTRAP: addiu $1, $zero, 2 # encoding: [0x02,0x00,0x01,0x24] +# CHECK-NOTRAP: ddivu $zero, $4, $1 # encoding: [0x1f,0x00,0x81,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,-1 +# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24] +# CHECK-NOTRAP: ddivu $zero, $4, $1 # encoding: [0x1f,0x00,0x81,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,0x1a5a5 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-NOTRAP: ori $1, $1, 42405 # encoding: [0xa5,0xa5,0x21,0x34] +# CHECK-NOTRAP: ddivu $zero, $4, $1 # encoding: [0x1f,0x00,0x81,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,0x10000 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-NOTRAP: ddivu $zero, $4, $1 # encoding: [0x1f,0x00,0x81,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,-0x8000 +# CHECK-NOTRAP: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24] +# CHECK-NOTRAP: ddivu $zero, $4, $1 # encoding: [0x1f,0x00,0x81,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,0x8000 +# CHECK-NOTRAP: ori $1, $zero, 32768 # encoding: [0x00,0x80,0x01,0x34] +# CHECK-NOTRAP: ddivu $zero, $4, $1 # encoding: [0x1f,0x00,0x81,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,$5,$6 +# CHECK-NOTRAP: bne $6, $zero, 8 # encoding: [0x02,0x00,0xc0,0x14] +# CHECK-NOTRAP: ddivu $zero, $5, $6 # encoding: [0x1f,0x00,0xa6,0x00] +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,$5,$0 +# CHECK-NOTRAP: bne $zero, $zero, 8 # encoding: [0x02,0x00,0x00,0x14] +# CHECK-NOTRAP: ddivu $zero, $5, $zero # encoding: [0x1f,0x00,0xa0,0x00] +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,$0,$0 +# CHECK-NOTRAP: bne $zero, $zero, 8 # encoding: [0x02,0x00,0x00,0x14] +# CHECK-NOTRAP: ddivu $zero, $zero, $zero # encoding: [0x1f,0x00,0x00,0x00] +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $0,$4,$5 +# CHECK-NOTRAP: ddivu $zero, $4, $5 # encoding: [0x1f,0x00,0x85,0x00] + + dremu $0,$5,$4 +# CHECK-NOTRAP: ddivu $zero, $5, $4 # encoding: [0x1f,0x00,0xa4,0x00] + + dremu $4,$5,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] + + dremu $4,$0,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] + + dremu $4,$5,1 +# CHECK-NOTRAP: addu $4, $zero, $zero # encoding: [0x21,0x20,0x00,0x00] + + dremu $4,$5,-1 +# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24] +# CHECK-NOTRAP: ddivu $zero, $5, $1 # encoding: [0x1f,0x00,0xa1,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,$5,2 +# CHECK-NOTRAP: addiu $1, $zero, 2 # encoding: [0x02,0x00,0x01,0x24] +# CHECK-NOTRAP: ddivu $zero, $5, $1 # encoding: [0x1f,0x00,0xa1,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,$5,0x8000 +# CHECK-NOTRAP: ori $1, $zero, 32768 # encoding: [0x00,0x80,0x01,0x34] +# CHECK-NOTRAP: ddivu $zero, $5, $1 # encoding: [0x1f,0x00,0xa1,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,$5,-0x8000 +# CHECK-NOTRAP: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24] +# CHECK-NOTRAP: ddivu $zero, $5, $1 # encoding: [0x1f,0x00,0xa1,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,$5,0x10000 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-NOTRAP: ddivu $zero, $5, $1 # encoding: [0x1f,0x00,0xa1,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,$5,0x1a5a5 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-NOTRAP: ori $1, $1, 42405 # encoding: [0xa5,0xa5,0x21,0x34] +# CHECK-NOTRAP: ddivu $zero, $5, $1 # encoding: [0x1f,0x00,0xa1,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,$5 +# CHECK-TRAP: teq $5, $zero, 7 # encoding: [0xf4,0x01,0xa0,0x00] +# CHECK-TRAP: ddivu $zero, $4, $5 # encoding: [0x1f,0x00,0x85,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,$0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] +# CHECK-TRAP: ddivu $zero, $4, $zero # encoding: [0x1f,0x00,0x80,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + dremu $0,0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + dremu $4,1 +# CHECK-TRAP: addu $4, $zero, $zero # encoding: [0x21,0x20,0x00,0x00] + + dremu $4,2 +# CHECK-TRAP: addiu $1, $zero, 2 # encoding: [0x02,0x00,0x01,0x24] +# CHECK-TRAP: ddivu $zero, $4, $1 # encoding: [0x1f,0x00,0x81,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,-1 +# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24] +# CHECK-TRAP: ddivu $zero, $4, $1 # encoding: [0x1f,0x00,0x81,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,0x1a5a5 +# CHECK-TRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-TRAP: ori $1, $1, 42405 # encoding: [0xa5,0xa5,0x21,0x34] +# CHECK-TRAP: ddivu $zero, $4, $1 # encoding: [0x1f,0x00,0x81,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,0x10000 +# CHECK-TRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-TRAP: ddivu $zero, $4, $1 # encoding: [0x1f,0x00,0x81,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,-0x8000 +# CHECK-TRAP: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24] +# CHECK-TRAP: ddivu $zero, $4, $1 # encoding: [0x1f,0x00,0x81,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,0x8000 +# CHECK-TRAP: ori $1, $zero, 32768 # encoding: [0x00,0x80,0x01,0x34] +# CHECK-TRAP: ddivu $zero, $4, $1 # encoding: [0x1f,0x00,0x81,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,$5,$6 +# CHECK-TRAP: teq $6, $zero, 7 # encoding: [0xf4,0x01,0xc0,0x00] +# CHECK-TRAP: ddivu $zero, $5, $6 # encoding: [0x1f,0x00,0xa6,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,$5,$0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] +# CHECK-TRAP: ddivu $zero, $5, $zero # encoding: [0x1f,0x00,0xa0,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,$0,$0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] +# CHECK-TRAP: ddivu $zero, $zero, $zero # encoding: [0x1f,0x00,0x00,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $0,$4,$5 +# CHECK-TRAP: ddivu $zero, $4, $5 # encoding: [0x1f,0x00,0x85,0x00] + + dremu $0,$5,$4 +# CHECK-TRAP: ddivu $zero, $5, $4 # encoding: [0x1f,0x00,0xa4,0x00] + + dremu $4,$5,0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + dremu $4,$0,0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + dremu $4,$5,1 +# CHECK-TRAP: addu $4, $zero, $zero # encoding: [0x21,0x20,0x00,0x00] + + dremu $4,$5,-1 +# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24] +# CHECK-TRAP: ddivu $zero, $5, $1 # encoding: [0x1f,0x00,0xa1,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,$5,2 +# CHECK-TRAP: addiu $1, $zero, 2 # encoding: [0x02,0x00,0x01,0x24] +# CHECK-TRAP: ddivu $zero, $5, $1 # encoding: [0x1f,0x00,0xa1,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,$5,0x8000 +# CHECK-TRAP: ori $1, $zero, 32768 # encoding: [0x00,0x80,0x01,0x34] +# CHECK-TRAP: ddivu $zero, $5, $1 # encoding: [0x1f,0x00,0xa1,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,$5,-0x8000 +# CHECK-TRAP: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24] +# CHECK-TRAP: ddivu $zero, $5, $1 # encoding: [0x1f,0x00,0xa1,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,$5,0x10000 +# CHECK-TRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-TRAP: ddivu $zero, $5, $1 # encoding: [0x1f,0x00,0xa1,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + dremu $4,$5,0x1a5a5 +# CHECK-TRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-TRAP: ori $1, $1, 42405 # encoding: [0xa5,0xa5,0x21,0x34] +# CHECK-TRAP: ddivu $zero, $5, $1 # encoding: [0x1f,0x00,0xa1,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] Index: test/MC/Mips/macro-rem.s =================================================================== --- /dev/null +++ test/MC/Mips/macro-rem.s @@ -0,0 +1,222 @@ +# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips32 | \ +# RUN: FileCheck %s --check-prefix=CHECK-NOTRAP +# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips32 \ +# RUN: -mattr=+use-tcc-in-div | FileCheck %s --check-prefix=CHECK-TRAP + + rem $4,$5 +# CHECK-NOTRAP: bnez $5, 8 # encoding: [0x02,0x00,0xa0,0x14] +# CHECK-NOTRAP: div $zero, $4, $5 # encoding: [0x1a,0x00,0x85,0x00] +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24] +# CHECK-NOTRAP: bne $5, $1, 16 # encoding: [0x04,0x00,0xa1,0x14] +# CHECK-NOTRAP: lui $1, 32768 # encoding: [0x00,0x80,0x01,0x3c] +# CHECK-NOTRAP: bne $4, $1, 8 # encoding: [0x02,0x00,0x81,0x14] +# CHECK-NOTRAP: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-NOTRAP: break 6 # encoding: [0x0d,0x00,0x06,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + rem $4,$0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] + + rem $4,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] + + rem $0,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] + + rem $4,1 +# CHECK-NOTRAP: move $4, $zero # encoding: [0x21,0x20,0x00,0x00] + + rem $4,-1 +# CHECK-NOTRAP: move $4, $zero # encoding: [0x21,0x20,0x00,0x00] + + rem $4,2 +# CHECK-NOTRAP: addiu $1, $zero, 2 # encoding: [0x02,0x00,0x01,0x24] +# CHECK-NOTRAP: div $zero, $4, $1 # encoding: [0x1a,0x00,0x81,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + rem $4,0x8000 +# CHECK-NOTRAP: ori $1, $zero, 32768 # encoding: [0x00,0x80,0x01,0x34] +# CHECK-NOTRAP: div $zero, $4, $1 # encoding: [0x1a,0x00,0x81,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + rem $4,-0x8000 +# CHECK-NOTRAP: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24] +# CHECK-NOTRAP: div $zero, $4, $1 # encoding: [0x1a,0x00,0x81,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + rem $4,0x10000 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-NOTRAP: div $zero, $4, $1 # encoding: [0x1a,0x00,0x81,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + rem $4,0x1a5a5 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-NOTRAP: ori $1, $1, 42405 # encoding: [0xa5,0xa5,0x21,0x34] +# CHECK-NOTRAP: div $zero, $4, $1 # encoding: [0x1a,0x00,0x81,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + rem $4,$5,$6 +# CHECK-NOTRAP: bnez $6, 8 # encoding: [0x02,0x00,0xc0,0x14] +# CHECK-NOTRAP: div $zero, $5, $6 # encoding: [0x1a,0x00,0xa6,0x00] +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24] +# CHECK-NOTRAP: bne $6, $1, 16 # encoding: [0x04,0x00,0xc1,0x14] +# CHECK-NOTRAP: lui $1, 32768 # encoding: [0x00,0x80,0x01,0x3c] +# CHECK-NOTRAP: bne $5, $1, 8 # encoding: [0x02,0x00,0xa1,0x14] +# CHECK-NOTRAP: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-NOTRAP: break 6 # encoding: [0x0d,0x00,0x06,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + rem $4,$5,$0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] + + rem $4,$0,$0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] + + rem $0,$5,$4 +# CHECK-NOTRAP: div $zero, $5, $4 # encoding: [0x1a,0x00,0xa4,0x00] + + rem $4,$5,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] + + rem $4,$0,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] + + rem $4,$5,1 +# CHECK-NOTRAP: move $4, $zero # encoding: [0x21,0x20,0x00,0x00] + + rem $4,$5,-1 +# CHECK-NOTRAP: move $4, $zero # encoding: [0x21,0x20,0x00,0x00] + + rem $4,$5,2 +# CHECK-NOTRAP: addiu $1, $zero, 2 # encoding: [0x02,0x00,0x01,0x24] +# CHECK-NOTRAP: div $zero, $5, $1 # encoding: [0x1a,0x00,0xa1,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + rem $4,$5,0x8000 +# CHECK-NOTRAP: ori $1, $zero, 32768 # encoding: [0x00,0x80,0x01,0x34] +# CHECK-NOTRAP: div $zero, $5, $1 # encoding: [0x1a,0x00,0xa1,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + rem $4,$5,-0x8000 +# CHECK-NOTRAP: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24] +# CHECK-NOTRAP: div $zero, $5, $1 # encoding: [0x1a,0x00,0xa1,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + rem $4,$5,0x10000 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-NOTRAP: div $zero, $5, $1 # encoding: [0x1a,0x00,0xa1,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + rem $4,$5,0x1a5a5 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-NOTRAP: ori $1, $1, 42405 # encoding: [0xa5,0xa5,0x21,0x34] +# CHECK-NOTRAP: div $zero, $5, $1 # encoding: [0x1a,0x00,0xa1,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + rem $4,$5 +# CHECK-TRAP: teq $5, $zero, 7 # encoding: [0xf4,0x01,0xa0,0x00] +# CHECK-TRAP: div $zero, $4, $5 # encoding: [0x1a,0x00,0x85,0x00] +# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24] +# CHECK-TRAP: bne $5, $1, 8 # encoding: [0x02,0x00,0xa1,0x14] +# CHECK-TRAP: lui $1, 32768 # encoding: [0x00,0x80,0x01,0x3c] +# CHECK-TRAP: teq $4, $1, 6 # encoding: [0xb4,0x01,0x81,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + rem $4,$0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + rem $4,0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + rem $0,0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + rem $4,1 +# CHECK-TRAP: move $4, $zero # encoding: [0x21,0x20,0x00,0x00] + + rem $4,-1 +# CHECK-TRAP: move $4, $zero # encoding: [0x21,0x20,0x00,0x00] + + rem $4,2 +# CHECK-TRAP: addiu $1, $zero, 2 # encoding: [0x02,0x00,0x01,0x24] +# CHECK-TRAP: div $zero, $4, $1 # encoding: [0x1a,0x00,0x81,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + rem $4,0x8000 +# CHECK-TRAP: ori $1, $zero, 32768 # encoding: [0x00,0x80,0x01,0x34] +# CHECK-TRAP: div $zero, $4, $1 # encoding: [0x1a,0x00,0x81,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + rem $4,-0x8000 +# CHECK-TRAP: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24] +# CHECK-TRAP: div $zero, $4, $1 # encoding: [0x1a,0x00,0x81,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + rem $4,0x10000 +# CHECK-TRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-TRAP: div $zero, $4, $1 # encoding: [0x1a,0x00,0x81,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + rem $4,0x1a5a5 +# CHECK-TRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-TRAP: ori $1, $1, 42405 # encoding: [0xa5,0xa5,0x21,0x34] +# CHECK-TRAP: div $zero, $4, $1 # encoding: [0x1a,0x00,0x81,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + rem $4,$5,$6 +# CHECK-TRAP: teq $6, $zero, 7 # encoding: [0xf4,0x01,0xc0,0x00] +# CHECK-TRAP: div $zero, $5, $6 # encoding: [0x1a,0x00,0xa6,0x00] +# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24] +# CHECK-TRAP: bne $6, $1, 8 # encoding: [0x02,0x00,0xc1,0x14] +# CHECK-TRAP: lui $1, 32768 # encoding: [0x00,0x80,0x01,0x3c] +# CHECK-TRAP: teq $5, $1, 6 # encoding: [0xb4,0x01,0xa1,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + rem $4,$5,$0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + rem $4,$0,$0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + rem $0,$5,$4 +# CHECK-TRAP: div $zero, $5, $4 # encoding: [0x1a,0x00,0xa4,0x00] + + rem $4,$5,0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + rem $4,$0,0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + rem $4,$5,1 +# CHECK-TRAP: move $4, $zero # encoding: [0x21,0x20,0x00,0x00] + + rem $4,$5,-1 +# CHECK-TRAP: move $4, $zero # encoding: [0x21,0x20,0x00,0x00] + + rem $4,$5,2 +# CHECK-TRAP: addiu $1, $zero, 2 # encoding: [0x02,0x00,0x01,0x24] +# CHECK-TRAP: div $zero, $5, $1 # encoding: [0x1a,0x00,0xa1,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + rem $4,$5,0x8000 +# CHECK-TRAP: ori $1, $zero, 32768 # encoding: [0x00,0x80,0x01,0x34] +# CHECK-TRAP: div $zero, $5, $1 # encoding: [0x1a,0x00,0xa1,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + rem $4,$5,-0x8000 +# CHECK-TRAP: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24] +# CHECK-TRAP: div $zero, $5, $1 # encoding: [0x1a,0x00,0xa1,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + rem $4,$5,0x10000 +# CHECK-TRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-TRAP: div $zero, $5, $1 # encoding: [0x1a,0x00,0xa1,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + rem $4,$5,0x1a5a5 +# CHECK-TRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-TRAP: ori $1, $1, 42405 # encoding: [0xa5,0xa5,0x21,0x34] +# CHECK-TRAP: div $zero, $5, $1 # encoding: [0x1a,0x00,0xa1,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] Index: test/MC/Mips/macro-remu.s =================================================================== --- /dev/null +++ test/MC/Mips/macro-remu.s @@ -0,0 +1,225 @@ +# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips32 | \ +# RUN: FileCheck %s --check-prefix=CHECK-NOTRAP +# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips32 \ +# RUN: -mattr=+use-tcc-in-div | FileCheck %s --check-prefix=CHECK-TRAP + + remu $4,$5 +# CHECK-NOTRAP: bnez $5, 8 # encoding: [0x02,0x00,0xa0,0x14] +# CHECK-NOTRAP: divu $zero, $4, $5 # encoding: [0x1b,0x00,0x85,0x00] +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,$0 +# CHECK-NOTRAP: bnez $zero, 8 # encoding: [0x02,0x00,0x00,0x14] +# CHECK-NOTRAP: divu $zero, $4, $zero # encoding: [0x1b,0x00,0x80,0x00] +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] + + remu $0,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] + + remu $4,1 +# CHECK-NOTRAP: move $4, $zero # encoding: [0x21,0x20,0x00,0x00] + + remu $4,-1 +# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24] +# CHECK-NOTRAP: divu $zero, $4, $1 # encoding: [0x1b,0x00,0x81,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,2 +# CHECK-NOTRAP: addiu $1, $zero, 2 # encoding: [0x02,0x00,0x01,0x24] +# CHECK-NOTRAP: divu $zero, $4, $1 # encoding: [0x1b,0x00,0x81,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,0x8000 +# CHECK-NOTRAP: ori $1, $zero, 32768 # encoding: [0x00,0x80,0x01,0x34] +# CHECK-NOTRAP: divu $zero, $4, $1 # encoding: [0x1b,0x00,0x81,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,-0x8000 +# CHECK-NOTRAP: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24] +# CHECK-NOTRAP: divu $zero, $4, $1 # encoding: [0x1b,0x00,0x81,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,0x10000 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-NOTRAP: divu $zero, $4, $1 # encoding: [0x1b,0x00,0x81,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,0x1a5a5 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-NOTRAP: ori $1, $1, 42405 # encoding: [0xa5,0xa5,0x21,0x34] +# CHECK-NOTRAP: divu $zero, $4, $1 # encoding: [0x1b,0x00,0x81,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,$5,$6 +# CHECK-NOTRAP: bnez $6, 8 # encoding: [0x02,0x00,0xc0,0x14] +# CHECK-NOTRAP: divu $zero, $5, $6 # encoding: [0x1b,0x00,0xa6,0x00] +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,$5,$0 +# CHECK-NOTRAP: bnez $zero, 8 # encoding: [0x02,0x00,0x00,0x14] +# CHECK-NOTRAP: divu $zero, $5, $zero # encoding: [0x1b,0x00,0xa0,0x00] +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,$0,$0 +# CHECK-NOTRAP: bnez $zero, 8 # encoding: [0x02,0x00,0x00,0x14] +# CHECK-NOTRAP: divu $zero, $zero, $zero # encoding: [0x1b,0x00,0x00,0x00] +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $0,$5,$4 +# CHECK-NOTRAP: divu $zero, $5, $4 # encoding: [0x1b,0x00,0xa4,0x00] + + remu $4,$5,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] + + remu $4,$0,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] + + remu $4,$5,1 +# CHECK-NOTRAP: move $4, $zero # encoding: [0x21,0x20,0x00,0x00] + + remu $4,$5,-1 +# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24] +# CHECK-NOTRAP: divu $zero, $5, $1 # encoding: [0x1b,0x00,0xa1,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,$5,2 +# CHECK-NOTRAP: addiu $1, $zero, 2 # encoding: [0x02,0x00,0x01,0x24] +# CHECK-NOTRAP: divu $zero, $5, $1 # encoding: [0x1b,0x00,0xa1,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,$5,0x8000 +# CHECK-NOTRAP: ori $1, $zero, 32768 # encoding: [0x00,0x80,0x01,0x34] +# CHECK-NOTRAP: divu $zero, $5, $1 # encoding: [0x1b,0x00,0xa1,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,$5,-0x8000 +# CHECK-NOTRAP: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24] +# CHECK-NOTRAP: divu $zero, $5, $1 # encoding: [0x1b,0x00,0xa1,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,$5,0x10000 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-NOTRAP: divu $zero, $5, $1 # encoding: [0x1b,0x00,0xa1,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,$5,0x1a5a5 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-NOTRAP: ori $1, $1, 42405 # encoding: [0xa5,0xa5,0x21,0x34] +# CHECK-NOTRAP: divu $zero, $5, $1 # encoding: [0x1b,0x00,0xa1,0x00] +# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,$5 +# CHECK-TRAP: teq $5, $zero, 7 # encoding: [0xf4,0x01,0xa0,0x00] +# CHECK-TRAP: divu $zero, $4, $5 # encoding: [0x1b,0x00,0x85,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,$0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] +# CHECK-TRAP: divu $zero, $4, $zero # encoding: [0x1b,0x00,0x80,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + remu $0,0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + remu $4,1 +# CHECK-TRAP: move $4, $zero # encoding: [0x21,0x20,0x00,0x00] + + remu $4,-1 +# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24] +# CHECK-TRAP: divu $zero, $4, $1 # encoding: [0x1b,0x00,0x81,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,2 +# CHECK-TRAP: addiu $1, $zero, 2 # encoding: [0x02,0x00,0x01,0x24] +# CHECK-TRAP: divu $zero, $4, $1 # encoding: [0x1b,0x00,0x81,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,0x8000 +# CHECK-TRAP: ori $1, $zero, 32768 # encoding: [0x00,0x80,0x01,0x34] +# CHECK-TRAP: divu $zero, $4, $1 # encoding: [0x1b,0x00,0x81,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,-0x8000 +# CHECK-TRAP: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24] +# CHECK-TRAP: divu $zero, $4, $1 # encoding: [0x1b,0x00,0x81,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,0x10000 +# CHECK-TRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-TRAP: divu $zero, $4, $1 # encoding: [0x1b,0x00,0x81,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,0x1a5a5 +# CHECK-TRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-TRAP: ori $1, $1, 42405 # encoding: [0xa5,0xa5,0x21,0x34] +# CHECK-TRAP: divu $zero, $4, $1 # encoding: [0x1b,0x00,0x81,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,$5,$6 +# CHECK-TRAP: teq $6, $zero, 7 # encoding: [0xf4,0x01,0xc0,0x00] +# CHECK-TRAP: divu $zero, $5, $6 # encoding: [0x1b,0x00,0xa6,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,$5,$0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] +# CHECK-TRAP: divu $zero, $5, $zero # encoding: [0x1b,0x00,0xa0,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,$0,$0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] +# CHECK-TRAP: divu $zero, $zero, $zero # encoding: [0x1b,0x00,0x00,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $0,$5,$4 +# CHECK-TRAP: divu $zero, $5, $4 # encoding: [0x1b,0x00,0xa4,0x00] + + remu $4,$5,0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + remu $4,$0,0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + remu $4,$5,1 +# CHECK-TRAP: move $4, $zero # encoding: [0x21,0x20,0x00,0x00] + + remu $4,$5,-1 +# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24] +# CHECK-TRAP: divu $zero, $5, $1 # encoding: [0x1b,0x00,0xa1,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,$5,2 +# CHECK-TRAP: addiu $1, $zero, 2 # encoding: [0x02,0x00,0x01,0x24] +# CHECK-TRAP: divu $zero, $5, $1 # encoding: [0x1b,0x00,0xa1,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,$5,0x8000 +# CHECK-TRAP: ori $1, $zero, 32768 # encoding: [0x00,0x80,0x01,0x34] +# CHECK-TRAP: divu $zero, $5, $1 # encoding: [0x1b,0x00,0xa1,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,$5,-0x8000 +# CHECK-TRAP: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24] +# CHECK-TRAP: divu $zero, $5, $1 # encoding: [0x1b,0x00,0xa1,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,$5,0x10000 +# CHECK-TRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-TRAP: divu $zero, $5, $1 # encoding: [0x1b,0x00,0xa1,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] + + remu $4,$5,0x1a5a5 +# CHECK-TRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-TRAP: ori $1, $1, 42405 # encoding: [0xa5,0xa5,0x21,0x34] +# CHECK-TRAP: divu $zero, $5, $1 # encoding: [0x1b,0x00,0xa1,0x00] +# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00]