Index: lib/Target/Mips/AsmParser/MipsAsmParser.cpp =================================================================== --- lib/Target/Mips/AsmParser/MipsAsmParser.cpp +++ lib/Target/Mips/AsmParser/MipsAsmParser.cpp @@ -217,7 +217,11 @@ bool expandDiv(MCInst &Inst, SMLoc IDLoc, SmallVectorImpl &Instructions, const bool IsMips64, const bool Signed); - + + bool expandRem(MCInst &Inst, SMLoc IDLoc, + SmallVectorImpl &Instructions, const bool IsMips64, + const bool Signed); + bool expandUlh(MCInst &Inst, bool Signed, SMLoc IDLoc, SmallVectorImpl &Instructions); @@ -2026,17 +2030,37 @@ return expandCondBranches(Inst, IDLoc, Instructions) ? MER_Fail : MER_Success; case Mips::SDivMacro: + case Mips::SDivIMacro: return expandDiv(Inst, IDLoc, Instructions, false, true) ? MER_Fail - : MER_Success; + : MER_Success; case Mips::DSDivMacro: + case Mips::DSDivIMacro: return expandDiv(Inst, IDLoc, Instructions, true, true) ? MER_Fail - : MER_Success; + : MER_Success; case Mips::UDivMacro: + case Mips::UDivIMacro: return expandDiv(Inst, IDLoc, Instructions, false, false) ? MER_Fail - : MER_Success; + : MER_Success; case Mips::DUDivMacro: + case Mips::DUDivIMacro: return expandDiv(Inst, IDLoc, Instructions, true, false) ? MER_Fail + : MER_Success; + case Mips::SRemMacro: + case Mips::SRemIMacro: + return expandRem(Inst, IDLoc, Instructions, false, true)? MER_Fail + : MER_Success; + case Mips::URemMacro: + case Mips::URemIMacro: + return expandRem(Inst, IDLoc, Instructions, false, false)? MER_Fail : MER_Success; + case Mips::DURemMacro: + case Mips::DURemIMacro: + return expandRem(Inst, IDLoc, Instructions, true, false)? MER_Fail + : MER_Success; + case Mips::DSRemMacro: + case Mips::DSRemIMacro: + return expandRem(Inst, IDLoc, Instructions, true, true)? MER_Fail + : MER_Success; case Mips::Ulh: return expandUlh(Inst, true, IDLoc, Instructions) ? MER_Fail : MER_Success; case Mips::Ulhu: @@ -2914,6 +2938,11 @@ bool MipsAsmParser::expandDiv(MCInst &Inst, SMLoc IDLoc, SmallVectorImpl &Instructions, const bool IsMips64, const bool Signed) { + assert(Inst.getNumOperands() == 3 && "Invalid operand count"); + assert(Inst.getOperand(0).isReg() && Inst.getOperand(1).isReg() && + (Inst.getOperand(2).isReg() || Inst.getOperand(2).isImm()) && + "Invalid instruction operand."); + if (hasMips32r6()) { Error(IDLoc, "instruction not supported on mips32r6 or mips64r6"); return false; @@ -2921,58 +2950,24 @@ warnIfNoMacro(IDLoc); - const MCOperand &RsRegOp = Inst.getOperand(0); - assert(RsRegOp.isReg() && "expected register operand kind"); - unsigned RsReg = RsRegOp.getReg(); - - const MCOperand &RtRegOp = Inst.getOperand(1); - assert(RtRegOp.isReg() && "expected register operand kind"); - unsigned RtReg = RtRegOp.getReg(); + unsigned FirstReg = Inst.getOperand(0).getReg(); + unsigned SecondReg = Inst.getOperand(1).getReg(); unsigned DivOp; unsigned ZeroReg; + unsigned SubOp; if (IsMips64) { DivOp = Signed ? Mips::DSDIV : Mips::DUDIV; ZeroReg = Mips::ZERO_64; + SubOp = Mips::DSUB; } else { DivOp = Signed ? Mips::SDIV : Mips::UDIV; ZeroReg = Mips::ZERO; + SubOp = Mips::SUB; } bool UseTraps = useTraps(); - - if (RsReg == Mips::ZERO || RsReg == Mips::ZERO_64) { - if (RtReg == Mips::ZERO || RtReg == Mips::ZERO_64) - Warning(IDLoc, "dividing zero by zero"); - if (IsMips64) { - if (Signed && (RtReg == Mips::ZERO || RtReg == Mips::ZERO_64)) { - if (UseTraps) { - emitRRI(Mips::TEQ, RtReg, ZeroReg, 0x7, IDLoc, Instructions); - return false; - } - - emitII(Mips::BREAK, 0x7, 0, IDLoc, Instructions); - return false; - } - } else { - emitRR(DivOp, RsReg, RtReg, IDLoc, Instructions); - return false; - } - } - - if (RtReg == Mips::ZERO || RtReg == Mips::ZERO_64) { - Warning(IDLoc, "division by zero"); - if (Signed) { - if (UseTraps) { - emitRRI(Mips::TEQ, RtReg, ZeroReg, 0x7, IDLoc, Instructions); - return false; - } - - emitII(Mips::BREAK, 0x7, 0, IDLoc, Instructions); - return false; - } - } - + // FIXME: The values for these two BranchTarget variables may be different in // micromips. These magic numbers need to be removed. unsigned BranchTargetNoTraps; @@ -2980,50 +2975,249 @@ if (UseTraps) { BranchTarget = IsMips64 ? 12 : 8; - emitRRI(Mips::TEQ, RtReg, ZeroReg, 0x7, IDLoc, Instructions); + } else { BranchTarget = IsMips64 ? 20 : 16; BranchTargetNoTraps = 8; - // Branch to the li instruction. - emitRRI(Mips::BNE, RtReg, ZeroReg, BranchTargetNoTraps, IDLoc, - Instructions); } - emitRR(DivOp, RsReg, RtReg, IDLoc, Instructions); + unsigned ATReg = getATReg(IDLoc); + if (!ATReg) + return true; + + if (Inst.getOperand(2).isReg()) { + unsigned ThirdReg = Inst.getOperand(2).getReg(); + + if (ThirdReg == Mips::ZERO || ThirdReg == Mips::ZERO_64) { + if (SecondReg == Mips::ZERO || SecondReg == Mips::ZERO_64) { + + Warning(IDLoc, "dividing zero by zero"); + + if (IsMips64) { + if (Signed) { + if (UseTraps) + emitRRI(Mips::TEQ, ThirdReg, ZeroReg, 0x7, IDLoc, Instructions); + else + emitII(Mips::BREAK, 0x7, 0, IDLoc, Instructions); + return false; + } else if (!UseTraps) { + emitRRI(Mips::BNE, ZeroReg, ZeroReg, BranchTargetNoTraps, IDLoc, + Instructions); + emitRR(DivOp, SecondReg, ZeroReg, IDLoc, Instructions); + emitII(Mips::BREAK, 0x7, 0, IDLoc, Instructions); + emitR(Mips::MFLO, FirstReg, IDLoc, Instructions); + return false; + } + } else { + if (FirstReg == Mips::ZERO || FirstReg == Mips::ZERO_64) { + emitRR(DivOp, ZeroReg, ZeroReg, IDLoc, Instructions); + return false; + } else if (Signed) { + if (UseTraps) + emitRRI(Mips::TEQ, ThirdReg, ZeroReg, 0x7, IDLoc, Instructions); + else + emitII(Mips::BREAK, 0x7, 0, IDLoc, Instructions); + return false; + } + } + } + + Warning(IDLoc, "division by zero"); + + if (Signed) { + if (UseTraps) + emitRRI(Mips::TEQ, ThirdReg, ZeroReg, 0x7, IDLoc, Instructions); + else + emitII(Mips::BREAK, 0x7, 0, IDLoc, Instructions); + return false; + } else { + emitRRI(UseTraps ? Mips::TEQ : Mips::BNE, ZeroReg, ZeroReg, + UseTraps ? 0x7 : 8, IDLoc, Instructions); + emitRR(DivOp, SecondReg, ZeroReg, IDLoc, Instructions); + + if (!UseTraps) + emitII(Mips::BREAK, 0x7, 0, IDLoc, Instructions); + + emitR(Mips::MFLO, FirstReg, IDLoc, Instructions); + return false; + } + } + + if (!IsMips64 && FirstReg == ZeroReg) { + emitRR(DivOp, ZeroReg, ThirdReg, IDLoc, Instructions); + return false; + } + + emitRRI(UseTraps ? Mips::TEQ : Mips::BNE, ThirdReg, ZeroReg, + UseTraps ? 0x7 : 8, IDLoc, Instructions); + emitRR(DivOp, SecondReg, ThirdReg, IDLoc, Instructions); + + if (!UseTraps) + emitII(Mips::BREAK, 7, 0, IDLoc, Instructions); + + if (!Signed) { + emitR(Mips::MFLO, FirstReg, IDLoc, Instructions); + return false; + } + if (loadImmediate(-1, ATReg, ZeroReg, true, false, Inst.getLoc(), + Instructions)) + return true; + + emitRRI(Mips::BNE, ThirdReg, ATReg, BranchTarget, IDLoc, Instructions); + if (IsMips64) { + emitRRI(Mips::ADDiu, ATReg, ZeroReg, 1, IDLoc, Instructions); + emitRRI(Mips::DSLL32, ATReg, ATReg, 0x1f, IDLoc, Instructions); + } else + emitRI(Mips::LUi, ATReg, (uint16_t)0x8000, IDLoc, Instructions); + + emitRRI(UseTraps ? Mips::TEQ : Mips::BNE, SecondReg, ATReg, + UseTraps ? 6 : 8, IDLoc, Instructions); + + if (!UseTraps) { + if (IsMips64) + emitRRI(Mips::SLL, ZeroReg, ZeroReg, 0, IDLoc, Instructions); + else + createNop(false, IDLoc, Instructions); + emitII(Mips::BREAK, 6, 0, IDLoc, Instructions); + } + emitR(Mips::MFLO, FirstReg, IDLoc, Instructions); + } + + if (Inst.getOperand(2).isImm()) { + int32_t ImmValue = Inst.getOperand(2).getImm(); + + if (ImmValue == 0) { + + if (SecondReg == Mips::ZERO || SecondReg == Mips::ZERO_64) + Warning(IDLoc, "dividing zero by zero"); + else + Warning(IDLoc, "division by zero"); + if (UseTraps) + emitRRI(Mips::TEQ, ZeroReg, ZeroReg, 0x7, IDLoc, Instructions); + else + emitII(Mips::BREAK, 0x7, 0, IDLoc, Instructions); + return false; + } + + if (ImmValue == 1) { + emitRRR(Mips::ADDu, FirstReg, SecondReg, Mips::ZERO, IDLoc, Instructions); + } else if (Signed && ImmValue == -1) { + emitRRR(SubOp, FirstReg, Mips::ZERO, SecondReg, IDLoc, Instructions); + } else { + if (loadImmediate(ImmValue, ATReg, Mips::NoRegister, true, false, + Inst.getLoc(), Instructions)) + return true; - if (!UseTraps) - emitII(Mips::BREAK, 0x7, 0, IDLoc, Instructions); + emitRR(DivOp, SecondReg, ATReg, IDLoc, Instructions); + emitR(Mips::MFLO, FirstReg, IDLoc, Instructions); + } + } + return false; +} - if (!Signed) { - emitR(Mips::MFLO, RsReg, IDLoc, Instructions); +bool MipsAsmParser::expandRem(MCInst &Inst, SMLoc IDLoc, + SmallVectorImpl &Instructions, + const bool IsMips64, const bool Signed) { + assert(Inst.getNumOperands() == 3 && "Invalid operand count"); + assert(Inst.getOperand(0).isReg() && Inst.getOperand(1).isReg() && + (Inst.getOperand(2).isReg() || Inst.getOperand(2).isImm()) && + "Invalid instruction operand."); + + if (hasMips32r6()) { + Error(IDLoc, "instruction not supported on mips32r6 or mips64r6"); return false; } - unsigned ATReg = getATReg(IDLoc); - if (!ATReg) - return true; + warnIfNoMacro(IDLoc); + + unsigned FirstReg = Inst.getOperand(0).getReg(); + unsigned SecondReg = Inst.getOperand(1).getReg(); + unsigned DivOp; + unsigned ZeroReg; - emitRRI(Mips::ADDiu, ATReg, ZeroReg, -1, IDLoc, Instructions); if (IsMips64) { - // Branch to the mflo instruction. - emitRRI(Mips::BNE, RtReg, ATReg, BranchTarget, IDLoc, Instructions); - emitRRI(Mips::ADDiu, ATReg, ZeroReg, 1, IDLoc, Instructions); - emitRRI(Mips::DSLL32, ATReg, ATReg, 0x1f, IDLoc, Instructions); + DivOp = Signed ? Mips::DSDIV : Mips::DUDIV; + ZeroReg = Mips::ZERO_64; } else { - // Branch to the mflo instruction. - emitRRI(Mips::BNE, RtReg, ATReg, BranchTarget, IDLoc, Instructions); - emitRI(Mips::LUi, ATReg, (uint16_t)0x8000, IDLoc, Instructions); + DivOp = Signed ? Mips::SDIV : Mips::UDIV; + ZeroReg = Mips::ZERO; } + bool UseTraps = useTraps(); + + unsigned BranchTarget; + if (UseTraps) - emitRRI(Mips::TEQ, RsReg, ATReg, 0x6, IDLoc, Instructions); - else { - // Branch to the mflo instruction. - emitRRI(Mips::BNE, RsReg, ATReg, BranchTargetNoTraps, IDLoc, Instructions); - emitRRI(Mips::SLL, ZeroReg, ZeroReg, 0, IDLoc, Instructions); - emitII(Mips::BREAK, 0x6, 0, IDLoc, Instructions); + BranchTarget = IsMips64 ? 12 : 8; + else + BranchTarget = IsMips64 ? 20 : 16; + + unsigned ATReg = getATReg(IDLoc); + if (!ATReg) + return true; + + if (Inst.getOperand(2).isReg()) { + unsigned ThirdReg = Inst.getOperand(2).getReg(); + if (FirstReg == Mips::ZERO_64 || FirstReg == Mips::ZERO) + emitRR(DivOp, SecondReg, ThirdReg, IDLoc, Instructions); + else if (Signed && (ThirdReg == Mips::ZERO_64 || ThirdReg == Mips::ZERO)) { + if (UseTraps) + emitRRI(Mips::TEQ, ZeroReg, ZeroReg, 7, IDLoc, Instructions); + else + emitII(Mips::BREAK, 0x7, 0, IDLoc, Instructions); + Warning(IDLoc, "division by zero"); + } else { + emitRRI(UseTraps ? Mips::TEQ : Mips::BNE, ThirdReg, ZeroReg, + UseTraps ? 7 : 8, IDLoc, Instructions); + emitRR(DivOp, SecondReg, ThirdReg, IDLoc, Instructions); + if (!UseTraps) + emitII(Mips::BREAK, 0x7, 0, IDLoc, Instructions); + + if (Signed) { + if (loadImmediate(-1, ATReg, Mips::NoRegister, true, false, + Inst.getLoc(), Instructions)) + return true; + emitRRI(Mips::BNE, ThirdReg, ATReg, BranchTarget, IDLoc, Instructions); + + if (IsMips64) { + if (loadImmediate(1, ATReg, Mips::NoRegister, true, false, + Inst.getLoc(), Instructions)) + return true; + emitRRI(Mips::DSLL32, ATReg, ATReg, 0x1f, IDLoc, Instructions); + + } else + emitRI(Mips::LUi, ATReg, 0x8000, IDLoc, Instructions); + emitRRI(UseTraps ? Mips::TEQ : Mips::BNE, SecondReg, ATReg, + UseTraps ? 6 : 8, IDLoc, Instructions); + + if (!UseTraps) { + createNop(false, IDLoc, Instructions); + emitII(Mips::BREAK, 0x6, 0, IDLoc, Instructions); + } + } + emitR(Mips::MFHI, FirstReg, IDLoc, Instructions); + } + + } else if (Inst.getOperand(2).isImm()) { + int64_t ImmValue = Inst.getOperand(2).getImm(); + + if (ImmValue == 1 || (Signed && (ImmValue == -1))) + emitRRR(Mips::ADDu, FirstReg, ZeroReg, ZeroReg, IDLoc, Instructions); + else if (ImmValue == 0) { + if (UseTraps) + emitRRI(Mips::TEQ, ZeroReg, ZeroReg, 7, IDLoc, Instructions); + else + emitII(Mips::BREAK, 0x7, 0, IDLoc, Instructions); + Warning(IDLoc, "division by zero"); + } else { + if (loadImmediate(ImmValue, ATReg, Mips::NoRegister, true, false, + Inst.getLoc(), Instructions)) + return true; + emitRR(DivOp, SecondReg, ATReg, IDLoc, Instructions); + emitR(Mips::MFHI, FirstReg, IDLoc, Instructions); + return false; + } } - emitR(Mips::MFLO, RsReg, IDLoc, Instructions); return false; } Index: lib/Target/Mips/MipsInstrInfo.td =================================================================== --- lib/Target/Mips/MipsInstrInfo.td +++ lib/Target/Mips/MipsInstrInfo.td @@ -2008,17 +2008,138 @@ // Once the tablegen-erated errors are made better, this needs to be fixed and // predicates needs to be restored. -def SDivMacro : MipsAsmPseudoInst<(outs), (ins GPR32Opnd:$rs, GPR32Opnd:$rt), - "div\t$rs, $rt">; //, ISA_MIPS1_NOT_32R6_64R6; +def SDivMacro : MipsAsmPseudoInst<(outs GPR32Opnd:$rd), + (ins GPR32Opnd:$rs, GPR32Opnd:$rt), + "div\t$rd, $rs, $rt">, + ISA_MIPS1_NOT_32R6_64R6; + +def SDivIMacro : MipsAsmPseudoInst<(outs GPR32Opnd:$rd), + (ins GPR32Opnd:$rs, simm16:$imm), + "div\t$rd, $rs, $imm">, + ISA_MIPS1_NOT_32R6_64R6; + +def UDivMacro : MipsAsmPseudoInst<(outs GPR32Opnd:$rd), + (ins GPR32Opnd:$rs, GPR32Opnd:$rt), + "divu\t$rd, $rs, $rt">, + ISA_MIPS1_NOT_32R6_64R6; + +def UDivIMacro : MipsAsmPseudoInst<(outs GPR32Opnd:$rd), + (ins GPR32Opnd:$rs, simm16:$imm), + "divu\t$rd, $rs, $imm">, + ISA_MIPS1_NOT_32R6_64R6; + +def DUDivMacro : MipsAsmPseudoInst<(outs GPR32Opnd:$rd), + (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">, + ISA_MIPS64_NOT_64R6; + +def DSDivMacro : MipsAsmPseudoInst<(outs GPR32Opnd:$rd), + (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">, + 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 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 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 UDivMacro : MipsAsmPseudoInst<(outs), (ins GPR32Opnd:$rs, GPR32Opnd:$rt), - "divu\t$rs, $rt">; //, ISA_MIPS1_NOT_32R6_64R6; +def : MipsInstAlias<"div $rd, $rs", (SDivMacro GPR32Opnd:$rd, GPR32Opnd:$rd, + GPR32Opnd:$rs), 0>; -def DSDivMacro : MipsAsmPseudoInst<(outs), (ins GPR32Opnd:$rs, GPR32Opnd:$rt), - "ddiv\t$rs, $rt">; //, ISA_MIPS64_NOT_64R6; +def : MipsInstAlias<"div $rd, $imm", (SDivIMacro GPR32Opnd:$rd, GPR32Opnd:$rd, + simm16:$imm), 0>, + ISA_MIPS1_NOT_32R6_64R6; + +def : MipsInstAlias<"divu $rd, $rs", (UDivMacro GPR32Opnd:$rd, GPR32Opnd:$rd, + GPR32Opnd:$rs), 0>; + +def : MipsInstAlias<"divu $rd, $imm", (UDivIMacro GPR32Opnd:$rd, GPR32Opnd:$rd, + simm16:$imm), 0>, + ISA_MIPS1_NOT_32R6_64R6; + +def : MipsInstAlias<"ddiv $rd, $rs", (DSDivMacro GPR32Opnd:$rd, GPR32Opnd:$rd, + GPR32Opnd:$rs), 0>; + +def : MipsInstAlias<"ddiv $rd, $imm", (DSDivIMacro GPR32Opnd:$rd, GPR32Opnd:$rd, + simm16:$imm), 0>, ISA_MIPS64_NOT_64R6; + +def : MipsInstAlias<"ddivu $rd, $rs", (DUDivMacro GPR32Opnd:$rd, GPR32Opnd:$rd, + GPR32Opnd:$rs), 0>; + +def : MipsInstAlias<"ddivu $rd, $imm", (DUDivIMacro GPR32Opnd:$rd, + GPR32Opnd:$rd, simm16:$imm), 0>, + ISA_MIPS64_NOT_64R6; + +def : MipsInstAlias<"rem $rd, $rs", (SRemMacro GPR32Opnd:$rd, GPR32Opnd:$rd, + GPR32Opnd:$rs), 0>; + +def : MipsInstAlias<"rem $rd, $imm", (SRemIMacro GPR32Opnd:$rd, GPR32Opnd:$rd, + simm16:$imm), 0>, ISA_MIPS1_NOT_32R6_64R6; + +def : MipsInstAlias<"remu $rd, $rs", (URemMacro GPR32Opnd:$rd, GPR32Opnd:$rd, + GPR32Opnd:$rs), 0>; + +def : MipsInstAlias<"remu $rd, $imm", (URemIMacro GPR32Opnd:$rd, GPR32Opnd:$rd, + simm16:$imm), 0>, + ISA_MIPS1_NOT_32R6_64R6; + +def : MipsInstAlias<"drem $rd, $rs", (DSRemMacro GPR32Opnd:$rd, GPR32Opnd:$rd, + GPR32Opnd:$rs), 0>; + +def : MipsInstAlias<"drem $rd, $imm", (DSRemIMacro GPR32Opnd:$rd, GPR32Opnd:$rd, + simm16:$imm), 0>, ISA_MIPS64_NOT_64R6; + +def : MipsInstAlias<"dremu $rd, $rs", (DURemMacro GPR32Opnd:$rd, GPR32Opnd:$rd, + GPR32Opnd:$rs), 0>; -def DUDivMacro : MipsAsmPseudoInst<(outs), (ins GPR32Opnd:$rs, GPR32Opnd:$rt), - "ddivu\t$rs, $rt">; //, ISA_MIPS64_NOT_64R6; +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-ddiv.s =================================================================== --- test/MC/Mips/macro-ddiv.s +++ test/MC/Mips/macro-ddiv.s @@ -2,84 +2,240 @@ # RUN: FileCheck %s --check-prefix=CHECK-NOTRAP # RUN: llvm-mc %s -triple=mips-unknown-linux -show-encoding -mcpu=mips64r2 \ # RUN: -mattr=+use-tcc-in-div | FileCheck %s --check-prefix=CHECK-TRAP - - ddiv $25, $11 -# CHECK-NOTRAP: bne $11, $zero, 8 # encoding: [0x15,0x60,0x00,0x02] -# CHECK-NOTRAP: ddiv $zero, $25, $11 # encoding: [0x03,0x2b,0x00,0x1e] -# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] -# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] -# CHECK-NOTRAP: bne $11, $1, 20 # encoding: [0x15,0x61,0x00,0x05] -# CHECK-NOTRAP: addiu $1, $zero, 1 # encoding: [0x24,0x01,0x00,0x01] -# CHECK-NOTRAP: dsll32 $1, $1, 31 # encoding: [0x00,0x01,0x0f,0xfc] -# CHECK-NOTRAP: bne $25, $1, 8 # encoding: [0x17,0x21,0x00,0x02] -# CHECK-NOTRAP: sll $zero, $zero, 0 # encoding: [0x00,0x00,0x00,0x00] -# CHECK-NOTRAP: break 6 # encoding: [0x00,0x06,0x00,0x0d] -# CHECK-NOTRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] - - ddiv $24,$12 -# CHECK-NOTRAP: bne $12, $zero, 8 # encoding: [0x15,0x80,0x00,0x02] -# CHECK-NOTRAP: ddiv $zero, $24, $12 # encoding: [0x03,0x0c,0x00,0x1e] -# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] -# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] -# CHECK-NOTRAP: bne $12, $1, 20 # encoding: [0x15,0x81,0x00,0x05] -# CHECK-NOTRAP: addiu $1, $zero, 1 # encoding: [0x24,0x01,0x00,0x01] -# CHECK-NOTRAP: dsll32 $1, $1, 31 # encoding: [0x00,0x01,0x0f,0xfc] -# CHECK-NOTRAP: bne $24, $1, 8 # encoding: [0x17,0x01,0x00,0x02] -# CHECK-NOTRAP: sll $zero, $zero, 0 # encoding: [0x00,0x00,0x00,0x00] -# CHECK-NOTRAP: break 6 # encoding: [0x00,0x06,0x00,0x0d] -# CHECK-NOTRAP: mflo $24 # encoding: [0x00,0x00,0xc0,0x12] - - ddiv $25,$0 -# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] - - ddiv $0,$9 -# CHECK-NOTRAP: bne $9, $zero, 8 # encoding: [0x15,0x20,0x00,0x02] -# CHECK-NOTRAP: ddiv $zero, $zero, $9 # encoding: [0x00,0x09,0x00,0x1e] -# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] -# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] -# CHECK-NOTRAP: bne $9, $1, 20 # encoding: [0x15,0x21,0x00,0x05] -# CHECK-NOTRAP: addiu $1, $zero, 1 # encoding: [0x24,0x01,0x00,0x01] -# CHECK-NOTRAP: dsll32 $1, $1, 31 # encoding: [0x00,0x01,0x0f,0xfc] -# CHECK-NOTRAP: bne $zero, $1, 8 # encoding: [0x14,0x01,0x00,0x02] -# CHECK-NOTRAP: sll $zero, $zero, 0 # encoding: [0x00,0x00,0x00,0x00] -# CHECK-NOTRAP: break 6 # encoding: [0x00,0x06,0x00,0x0d] -# CHECK-NOTRAP: mflo $zero # encoding: [0x00,0x00,0x00,0x12] - - ddiv $0,$0 -# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] - + ddiv $25,$11 -# CHECK-TRAP: teq $11, $zero, 7 # encoding: [0x01,0x60,0x01,0xf4] -# CHECK-TRAP: ddiv $zero, $25, $11 # encoding: [0x03,0x2b,0x00,0x1e] -# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] -# CHECK-TRAP: bne $11, $1, 12 # encoding: [0x15,0x61,0x00,0x03] -# CHECK-TRAP: addiu $1, $zero, 1 # encoding: [0x24,0x01,0x00,0x01] -# CHECK-TRAP: dsll32 $1, $1, 31 # encoding: [0x00,0x01,0x0f,0xfc] -# CHECK-TRAP: teq $25, $1, 6 # encoding: [0x03,0x21,0x01,0xb4] -# CHECK-TRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] +# CHECK-NOTRAP: bne $11, $zero, 8 # encoding: [0x15,0x60,0x00,0x02] +# CHECK-NOTRAP: ddiv $zero, $25, $11 # encoding: [0x03,0x2b,0x00,0x1e] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-NOTRAP: bne $11, $1, 20 # encoding: [0x15,0x61,0x00,0x05] +# CHECK-NOTRAP: addiu $1, $zero, 1 # encoding: [0x24,0x01,0x00,0x01] +# CHECK-NOTRAP: dsll32 $1, $1, 31 # encoding: [0x00,0x01,0x0f,0xfc] +# CHECK-NOTRAP: bne $25, $1, 8 # encoding: [0x17,0x21,0x00,0x02] +# CHECK-NOTRAP: sll $zero, $zero, 0 # encoding: [0x00,0x00,0x00,0x00] +# CHECK-NOTRAP: break 6 # encoding: [0x00,0x06,0x00,0x0d] +# CHECK-NOTRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] +# CHECK-TRAP: teq $11, $zero, 7 # encoding: [0x01,0x60,0x01,0xf4] +# CHECK-TRAP: ddiv $zero, $25, $11 # encoding: [0x03,0x2b,0x00,0x1e] +# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-TRAP: bne $11, $1, 12 # encoding: [0x15,0x61,0x00,0x03] +# CHECK-TRAP: addiu $1, $zero, 1 # encoding: [0x24,0x01,0x00,0x01] +# CHECK-TRAP: dsll32 $1, $1, 31 # encoding: [0x00,0x01,0x0f,0xfc] +# CHECK-TRAP: teq $25, $1, 6 # encoding: [0x03,0x21,0x01,0xb4] +# CHECK-TRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] ddiv $24,$12 -# CHECK-TRAP: teq $12, $zero, 7 # encoding: [0x01,0x80,0x01,0xf4] -# CHECK-TRAP: ddiv $zero, $24, $12 # encoding: [0x03,0x0c,0x00,0x1e] -# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] -# CHECK-TRAP: bne $12, $1, 12 # encoding: [0x15,0x81,0x00,0x03] -# CHECK-TRAP: addiu $1, $zero, 1 # encoding: [0x24,0x01,0x00,0x01] -# CHECK-TRAP: dsll32 $1, $1, 31 # encoding: [0x00,0x01,0x0f,0xfc] -# CHECK-TRAP: teq $24, $1, 6 # encoding: [0x03,0x01,0x01,0xb4] -# CHECK-TRAP: mflo $24 # encoding: [0x00,0x00,0xc0,0x12] +# CHECK-NOTRAP: bne $12, $zero, 8 # encoding: [0x15,0x80,0x00,0x02] +# CHECK-NOTRAP: ddiv $zero, $24, $12 # encoding: [0x03,0x0c,0x00,0x1e] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-NOTRAP: bne $12, $1, 20 # encoding: [0x15,0x81,0x00,0x05] +# CHECK-NOTRAP: addiu $1, $zero, 1 # encoding: [0x24,0x01,0x00,0x01] +# CHECK-NOTRAP: dsll32 $1, $1, 31 # encoding: [0x00,0x01,0x0f,0xfc] +# CHECK-NOTRAP: bne $24, $1, 8 # encoding: [0x17,0x01,0x00,0x02] +# CHECK-NOTRAP: sll $zero, $zero, 0 # encoding: [0x00,0x00,0x00,0x00] +# CHECK-NOTRAP: break 6 # encoding: [0x00,0x06,0x00,0x0d] +# CHECK-NOTRAP: mflo $24 # encoding: [0x00,0x00,0xc0,0x12] +# CHECK-TRAP: teq $12, $zero, 7 # encoding: [0x01,0x80,0x01,0xf4] +# CHECK-TRAP: ddiv $zero, $24, $12 # encoding: [0x03,0x0c,0x00,0x1e] +# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-TRAP: bne $12, $1, 12 # encoding: [0x15,0x81,0x00,0x03] +# CHECK-TRAP: addiu $1, $zero, 1 # encoding: [0x24,0x01,0x00,0x01] +# CHECK-TRAP: dsll32 $1, $1, 31 # encoding: [0x00,0x01,0x0f,0xfc] +# CHECK-TRAP: teq $24, $1, 6 # encoding: [0x03,0x01,0x01,0xb4] +# CHECK-TRAP: mflo $24 # encoding: [0x00,0x00,0xc0,0x12] ddiv $25,$0 -# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] ddiv $0,$9 -# CHECK-TRAP: teq $9, $zero, 7 # encoding: [0x01,0x20,0x01,0xf4] -# CHECK-TRAP: ddiv $zero, $zero, $9 # encoding: [0x00,0x09,0x00,0x1e] -# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] -# CHECK-TRAP: bne $9, $1, 12 # encoding: [0x15,0x21,0x00,0x03] -# CHECK-TRAP: addiu $1, $zero, 1 # encoding: [0x24,0x01,0x00,0x01] -# CHECK-TRAP: dsll32 $1, $1, 31 # encoding: [0x00,0x01,0x0f,0xfc] -# CHECK-TRAP: teq $zero, $1, 6 # encoding: [0x00,0x01,0x01,0xb4] -# CHECK-TRAP: mflo $zero # encoding: [0x00,0x00,0x00,0x12] +# CHECK-NOTRAP: bne $9, $zero, 8 # encoding: [0x15,0x20,0x00,0x02] +# CHECK-NOTRAP: ddiv $zero, $zero, $9 # encoding: [0x00,0x09,0x00,0x1e] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-NOTRAP: bne $9, $1, 20 # encoding: [0x15,0x21,0x00,0x05] +# CHECK-NOTRAP: addiu $1, $zero, 1 # encoding: [0x24,0x01,0x00,0x01] +# CHECK-NOTRAP: dsll32 $1, $1, 31 # encoding: [0x00,0x01,0x0f,0xfc] +# CHECK-NOTRAP: bne $zero, $1, 8 # encoding: [0x14,0x01,0x00,0x02] +# CHECK-NOTRAP: sll $zero, $zero, 0 # encoding: [0x00,0x00,0x00,0x00] +# CHECK-NOTRAP: break 6 # encoding: [0x00,0x06,0x00,0x0d] +# CHECK-NOTRAP: mflo $zero # encoding: [0x00,0x00,0x00,0x12] +# CHECK-TRAP: teq $9, $zero, 7 # encoding: [0x01,0x20,0x01,0xf4] +# CHECK-TRAP: ddiv $zero, $zero, $9 # encoding: [0x00,0x09,0x00,0x1e] +# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-TRAP: bne $9, $1, 12 # encoding: [0x15,0x21,0x00,0x03] +# CHECK-TRAP: addiu $1, $zero, 1 # encoding: [0x24,0x01,0x00,0x01] +# CHECK-TRAP: dsll32 $1, $1, 31 # encoding: [0x00,0x01,0x0f,0xfc] +# CHECK-TRAP: teq $zero, $1, 6 # encoding: [0x00,0x01,0x01,0xb4] +# CHECK-TRAP: mflo $zero # encoding: [0x00,0x00,0x00,0x12] ddiv $0,$0 -# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] + + ddiv $4,1 +# CHECK-NOTRAP: move $4, $4 # encoding: [0x00,0x80,0x20,0x21] +# CHECK-TRAP: move $4, $4 # encoding: [0x00,0x80,0x20,0x21] + + ddiv $4,-1 +# CHECK-NOTRAP: dsub $4, $zero, $4 # encoding: [0x00,0x04,0x20,0x2e] +# CHECK-TRAP: dsub $4, $zero, $4 # encoding: [0x00,0x04,0x20,0x2e] + + ddiv $4,2 +# CHECK-NOTRAP: addiu $1, $zero, 2 # encoding: [0x24,0x01,0x00,0x02] +# CHECK-NOTRAP: ddiv $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1e] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: addiu $1, $zero, 2 # encoding: [0x24,0x01,0x00,0x02] +# CHECK-TRAP: ddiv $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1e] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddiv $4,0x8000 +# CHECK-NOTRAP: ori $1, $zero, 32768 # encoding: [0x34,0x01,0x80,0x00] +# CHECK-NOTRAP: ddiv $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1e] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: ori $1, $zero, 32768 # encoding: [0x34,0x01,0x80,0x00] +# CHECK-TRAP: ddiv $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1e] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddiv $4,-0x8000 +# CHECK-NOTRAP: addiu $1, $zero, -32768 # encoding: [0x24,0x01,0x80,0x00] +# CHECK-NOTRAP: ddiv $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1e] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: addiu $1, $zero, -32768 # encoding: [0x24,0x01,0x80,0x00] +# CHECK-TRAP: ddiv $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1e] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddiv $4,0x10000 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-NOTRAP: ddiv $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1e] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-TRAP: ddiv $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1e] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddiv $4,0x1a5a5 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-NOTRAP: ori $1, $1, 42405 # encoding: [0x34,0x21,0xa5,0xa5] +# CHECK-NOTRAP: ddiv $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1e] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-TRAP: ori $1, $1, 42405 # encoding: [0x34,0x21,0xa5,0xa5] +# CHECK-TRAP: ddiv $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1e] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddiv $4,0 +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] + + ddiv $0,0 +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] + + ddiv $4,$5,$6 +# CHECK-NOTRAP: bne $6, $zero, 8 # encoding: [0x14,0xc0,0x00,0x02] +# CHECK-NOTRAP: ddiv $zero, $5, $6 # encoding: [0x00,0xa6,0x00,0x1e] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-NOTRAP: bne $6, $1, 20 # encoding: [0x14,0xc1,0x00,0x05] +# CHECK-NOTRAP: addiu $1, $zero, 1 # encoding: [0x24,0x01,0x00,0x01] +# CHECK-NOTRAP: dsll32 $1, $1, 31 # encoding: [0x00,0x01,0x0f,0xfc] +# CHECK-NOTRAP: bne $5, $1, 8 # encoding: [0x14,0xa1,0x00,0x02] +# CHECK-NOTRAP: sll $zero, $zero, 0 # encoding: [0x00,0x00,0x00,0x00] +# CHECK-NOTRAP: break 6 # encoding: [0x00,0x06,0x00,0x0d] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: teq $6, $zero, 7 # encoding: [0x00,0xc0,0x01,0xf4] +# CHECK-TRAP: ddiv $zero, $5, $6 # encoding: [0x00,0xa6,0x00,0x1e] +# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-TRAP: bne $6, $1, 12 # encoding: [0x14,0xc1,0x00,0x03] +# CHECK-TRAP: addiu $1, $zero, 1 # encoding: [0x24,0x01,0x00,0x01] +# CHECK-TRAP: dsll32 $1, $1, 31 # encoding: [0x00,0x01,0x0f,0xfc] +# CHECK-TRAP: teq $5, $1, 6 # encoding: [0x00,0xa1,0x01,0xb4] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddiv $0,$4,$5 +# CHECK-NOTRAP: ddiv $zero, $4, $5 # encoding: [0x00,0x85,0x00,0x1e] +# CHECK-TRAP: ddiv $zero, $4, $5 # encoding: [0x00,0x85,0x00,0x1e] + + ddiv $4,$5,$0 +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] + + ddiv $4,$0,$5 +# CHECK-NOTRAP: bne $5, $zero, 8 # encoding: [0x14,0xa0,0x00,0x02] +# CHECK-NOTRAP: ddiv $zero, $zero, $5 # encoding: [0x00,0x05,0x00,0x1e] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-NOTRAP: bne $5, $1, 20 # encoding: [0x14,0xa1,0x00,0x05] +# CHECK-NOTRAP: addiu $1, $zero, 1 # encoding: [0x24,0x01,0x00,0x01] +# CHECK-NOTRAP: dsll32 $1, $1, 31 # encoding: [0x00,0x01,0x0f,0xfc] +# CHECK-NOTRAP: bne $zero, $1, 8 # encoding: [0x14,0x01,0x00,0x02] +# CHECK-NOTRAP: sll $zero, $zero, 0 # encoding: [0x00,0x00,0x00,0x00] +# CHECK-NOTRAP: break 6 # encoding: [0x00,0x06,0x00,0x0d] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: teq $5, $zero, 7 # encoding: [0x00,0xa0,0x01,0xf4] +# CHECK-TRAP: ddiv $zero, $zero, $5 # encoding: [0x00,0x05,0x00,0x1e] +# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-TRAP: bne $5, $1, 12 # encoding: [0x14,0xa1,0x00,0x03] +# CHECK-TRAP: addiu $1, $zero, 1 # encoding: [0x24,0x01,0x00,0x01] +# CHECK-TRAP: dsll32 $1, $1, 31 # encoding: [0x00,0x01,0x0f,0xfc] +# CHECK-TRAP: teq $zero, $1, 6 # encoding: [0x00,0x01,0x01,0xb4] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddiv $4,$0,$0 +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] + + ddiv $0,$0,$0 +# CHECK-NOTRAP: ddiv $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1e] +# CHECK-TRAP: ddiv $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1e] + + ddiv $4,$5,1 +# CHECK-NOTRAP: move $4, $5 # encoding: [0x00,0xa0,0x20,0x21] +# CHECK-TRAP: move $4, $5 # encoding: [0x00,0xa0,0x20,0x21] + + ddiv $4,$5,-1 +# CHECK-NOTRAP: dsub $4, $zero, $5 # encoding: [0x00,0x05,0x20,0x2e] +# CHECK-TRAP: dsub $4, $zero, $5 # encoding: [0x00,0x05,0x20,0x2e] + + ddiv $4,$5,2 +# CHECK-NOTRAP: addiu $1, $zero, 2 # encoding: [0x24,0x01,0x00,0x02] +# CHECK-NOTRAP: ddiv $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1e] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: addiu $1, $zero, 2 # encoding: [0x24,0x01,0x00,0x02] +# CHECK-TRAP: ddiv $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1e] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddiv $4,$5,0x8000 +# CHECK-NOTRAP: ori $1, $zero, 32768 # encoding: [0x34,0x01,0x80,0x00] +# CHECK-NOTRAP: ddiv $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1e] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: ori $1, $zero, 32768 # encoding: [0x34,0x01,0x80,0x00] +# CHECK-TRAP: ddiv $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1e] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddiv $4,$5,-0x8000 +# CHECK-NOTRAP: addiu $1, $zero, -32768 # encoding: [0x24,0x01,0x80,0x00] +# CHECK-NOTRAP: ddiv $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1e] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: addiu $1, $zero, -32768 # encoding: [0x24,0x01,0x80,0x00] +# CHECK-TRAP: ddiv $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1e] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddiv $4,$5,0x10000 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-NOTRAP: ddiv $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1e] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-TRAP: ddiv $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1e] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddiv $4,$5,0x1a5a5 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-NOTRAP: ori $1, $1, 42405 # encoding: [0x34,0x21,0xa5,0xa5] +# CHECK-NOTRAP: ddiv $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1e] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-TRAP: ori $1, $1, 42405 # encoding: [0x34,0x21,0xa5,0xa5] +# CHECK-TRAP: ddiv $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1e] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] Index: test/MC/Mips/macro-ddivu.s =================================================================== --- test/MC/Mips/macro-ddivu.s +++ test/MC/Mips/macro-ddivu.s @@ -4,56 +4,201 @@ # RUN: -mattr=+use-tcc-in-div | FileCheck %s --check-prefix=CHECK-TRAP ddivu $25,$11 -# CHECK-NOTRAP: bne $11, $zero, 8 # encoding: [0x15,0x60,0x00,0x02] -# CHECK-NOTRAP: ddivu $zero, $25, $11 # encoding: [0x03,0x2b,0x00,0x1f] -# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] -# CHECK-NOTRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] +# CHECK-NOTRAP: bne $11, $zero, 8 # encoding: [0x15,0x60,0x00,0x02] +# CHECK-NOTRAP: ddivu $zero, $25, $11 # encoding: [0x03,0x2b,0x00,0x1f] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] +# CHECK-TRAP: teq $11, $zero, 7 # encoding: [0x01,0x60,0x01,0xf4] +# CHECK-TRAP: ddivu $zero, $25, $11 # encoding: [0x03,0x2b,0x00,0x1f] +# CHECK-TRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] ddivu $24,$12 -# CHECK-NOTRAP: bne $12, $zero, 8 # encoding: [0x15,0x80,0x00,0x02] -# CHECK-NOTRAP: ddivu $zero, $24, $12 # encoding: [0x03,0x0c,0x00,0x1f] -# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] -# CHECK-NOTRAP: mflo $24 # encoding: [0x00,0x00,0xc0,0x12] +# CHECK-NOTRAP: bne $12, $zero, 8 # encoding: [0x15,0x80,0x00,0x02] +# CHECK-NOTRAP: ddivu $zero, $24, $12 # encoding: [0x03,0x0c,0x00,0x1f] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: mflo $24 # encoding: [0x00,0x00,0xc0,0x12] +# CHECK-TRAP: teq $12, $zero, 7 # encoding: [0x01,0x80,0x01,0xf4] +# CHECK-TRAP: ddivu $zero, $24, $12 # encoding: [0x03,0x0c,0x00,0x1f] +# CHECK-TRAP: mflo $24 # encoding: [0x00,0x00,0xc0,0x12] ddivu $25,$0 -# CHECK-NOTRAP: bne $zero, $zero, 8 # encoding: [0x14,0x00,0x00,0x02] -# CHECK-NOTRAP: ddivu $zero, $25, $zero # encoding: [0x03,0x20,0x00,0x1f] -# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] -# CHECK-NOTRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] +# CHECK-NOTRAP: bne $zero, $zero, 8 # encoding: [0x14,0x00,0x00,0x02] +# CHECK-NOTRAP: ddivu $zero, $25, $zero # encoding: [0x03,0x20,0x00,0x1f] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] +# CHECK-TRAP: ddivu $zero, $25, $zero # encoding: [0x03,0x20,0x00,0x1f] +# CHECK-TRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] ddivu $0,$9 -# CHECK-NOTRAP: bne $9, $zero, 8 # encoding: [0x15,0x20,0x00,0x02] -# CHECK-NOTRAP: ddivu $zero, $zero, $9 # encoding: [0x00,0x09,0x00,0x1f] -# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] -# CHECK-NOTRAP: mflo $zero # encoding: [0x00,0x00,0x00,0x12] +# CHECK-NOTRAP: bne $9, $zero, 8 # encoding: [0x15,0x20,0x00,0x02] +# CHECK-NOTRAP: ddivu $zero, $zero, $9 # encoding: [0x00,0x09,0x00,0x1f] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: mflo $zero # encoding: [0x00,0x00,0x00,0x12] +# CHECK-TRAP: teq $9, $zero, 7 # encoding: [0x01,0x20,0x01,0xf4] +# CHECK-TRAP: ddivu $zero, $zero, $9 # encoding: [0x00,0x09,0x00,0x1f] +# CHECK-TRAP: mflo $zero # encoding: [0x00,0x00,0x00,0x12] ddivu $0,$0 -# CHECK-NOTRAP: bne $zero, $zero, 8 # encoding: [0x14,0x00,0x00,0x02] -# CHECK-NOTRAP: ddivu $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1f] -# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] -# CHECK-NOTRAP: mflo $zero # encoding: [0x00,0x00,0x00,0x12] - - ddivu $25, $11 -# CHECK-TRAP: teq $11, $zero, 7 # encoding: [0x01,0x60,0x01,0xf4] -# CHECK-TRAP: ddivu $zero, $25, $11 # encoding: [0x03,0x2b,0x00,0x1f] -# CHECK-TRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] - - ddivu $24,$12 -# CHECK-TRAP: teq $12, $zero, 7 # encoding: [0x01,0x80,0x01,0xf4] -# CHECK-TRAP: ddivu $zero, $24, $12 # encoding: [0x03,0x0c,0x00,0x1f] -# CHECK-TRAP: mflo $24 # encoding: [0x00,0x00,0xc0,0x12] - - ddivu $25,$0 -# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] -# CHECK-TRAP: ddivu $zero, $25, $zero # encoding: [0x03,0x20,0x00,0x1f] -# CHECK-TRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] - - ddivu $0,$9 -# CHECK-TRAP: teq $9, $zero, 7 # encoding: [0x01,0x20,0x01,0xf4] -# CHECK-TRAP: ddivu $zero, $zero, $9 # encoding: [0x00,0x09,0x00,0x1f] -# CHECK-TRAP: mflo $zero # encoding: [0x00,0x00,0x00,0x12] - - ddivu $0,$0 -# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] -# CHECK-TRAP: ddivu $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1f] -# CHECK-TRAP: mflo $zero # encoding: [0x00,0x00,0x00,0x12] +# CHECK-NOTRAP: bne $zero, $zero, 8 # encoding: [0x14,0x00,0x00,0x02] +# CHECK-NOTRAP: ddivu $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1f] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: mflo $zero # encoding: [0x00,0x00,0x00,0x12] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] +# CHECK-TRAP: ddivu $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1f] +# CHECK-TRAP: mflo $zero # encoding: [0x00,0x00,0x00,0x12] + + ddivu $4,0 +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] + + ddivu $0,0 +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] + + ddivu $4,1 +# CHECK-NOTRAP: move $4, $4 # encoding: [0x00,0x80,0x20,0x21] +# CHECK-TRAP: move $4, $4 # encoding: [0x00,0x80,0x20,0x21] + + ddivu $4,-1 +# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-NOTRAP: ddivu $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1f] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-TRAP: ddivu $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1f] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddivu $4,0x8000 +# CHECK-NOTRAP: ori $1, $zero, 32768 # encoding: [0x34,0x01,0x80,0x00] +# CHECK-NOTRAP: ddivu $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1f] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: ori $1, $zero, 32768 # encoding: [0x34,0x01,0x80,0x00] +# CHECK-TRAP: ddivu $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1f] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddivu $4,-0x8000 +# CHECK-NOTRAP: addiu $1, $zero, -32768 # encoding: [0x24,0x01,0x80,0x00] +# CHECK-NOTRAP: ddivu $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1f] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: addiu $1, $zero, -32768 # encoding: [0x24,0x01,0x80,0x00] +# CHECK-TRAP: ddivu $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1f] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddivu $4,0x10000 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-NOTRAP: ddivu $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1f] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-TRAP: ddivu $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1f] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddivu $4,0x1a5a5 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-NOTRAP: ori $1, $1, 42405 # encoding: [0x34,0x21,0xa5,0xa5] +# CHECK-NOTRAP: ddivu $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1f] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-TRAP: ori $1, $1, 42405 # encoding: [0x34,0x21,0xa5,0xa5] +# CHECK-TRAP: ddivu $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1f] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddivu $4,$5,$6 +# CHECK-NOTRAP: bne $6, $zero, 8 # encoding: [0x14,0xc0,0x00,0x02] +# CHECK-NOTRAP: ddivu $zero, $5, $6 # encoding: [0x00,0xa6,0x00,0x1f] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: teq $6, $zero, 7 # encoding: [0x00,0xc0,0x01,0xf4] +# CHECK-TRAP: ddivu $zero, $5, $6 # encoding: [0x00,0xa6,0x00,0x1f] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddivu $4,$5,$0 +# CHECK-NOTRAP: bne $zero, $zero, 8 # encoding: [0x14,0x00,0x00,0x02] +# CHECK-NOTRAP: ddivu $zero, $5, $zero # encoding: [0x00,0xa0,0x00,0x1f] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] +# CHECK-TRAP: ddivu $zero, $5, $zero # encoding: [0x00,0xa0,0x00,0x1f] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddivu $4,$0,$0 +# CHECK-NOTRAP: bne $zero, $zero, 8 # encoding: [0x14,0x00,0x00,0x02] +# CHECK-NOTRAP: ddivu $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1f] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] +# CHECK-TRAP: ddivu $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1f] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddivu $0,$0,$0 +# CHECK-NOTRAP: ddivu $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1f] +# CHECK-TRAP: ddivu $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1f] + + ddivu $0,$4,$5 +# CHECK-NOTRAP: ddivu $zero, $4, $5 # encoding: [0x00,0x85,0x00,0x1f] +# CHECK-TRAP: ddivu $zero, $4, $5 # encoding: [0x00,0x85,0x00,0x1f] + + ddivu $4,$5,0 +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] + + ddivu $4,$0,0 +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] + + ddivu $0,$0,0 +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] + + ddivu $4,$5,1 +# CHECK-NOTRAP: move $4, $5 # encoding: [0x00,0xa0,0x20,0x21] +# CHECK-TRAP: move $4, $5 # encoding: [0x00,0xa0,0x20,0x21] + + ddivu $4,$5,-1 +# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-NOTRAP: ddivu $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1f] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-TRAP: ddivu $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1f] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddivu $4,$5,2 +# CHECK-NOTRAP: addiu $1, $zero, 2 # encoding: [0x24,0x01,0x00,0x02] +# CHECK-NOTRAP: ddivu $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1f] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: addiu $1, $zero, 2 # encoding: [0x24,0x01,0x00,0x02] +# CHECK-TRAP: ddivu $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1f] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddivu $4,$5,0x8000 +# CHECK-NOTRAP: ori $1, $zero, 32768 # encoding: [0x34,0x01,0x80,0x00] +# CHECK-NOTRAP: ddivu $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1f] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: ori $1, $zero, 32768 # encoding: [0x34,0x01,0x80,0x00] +# CHECK-TRAP: ddivu $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1f] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddivu $4,$5,-0x8000 +# CHECK-NOTRAP: addiu $1, $zero, -32768 # encoding: [0x24,0x01,0x80,0x00] +# CHECK-NOTRAP: ddivu $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1f] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: addiu $1, $zero, -32768 # encoding: [0x24,0x01,0x80,0x00] +# CHECK-TRAP: ddivu $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1f] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddivu $4,$5,0x10000 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-NOTRAP: ddivu $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1f] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-TRAP: ddivu $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1f] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddivu $4,$5,0x1a5a5 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-NOTRAP: ori $1, $1, 42405 # encoding: [0x34,0x21,0xa5,0xa5] +# CHECK-NOTRAP: ddivu $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1f] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-TRAP: ori $1, $1, 42405 # encoding: [0x34,0x21,0xa5,0xa5] +# CHECK-TRAP: ddivu $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1f] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] Index: test/MC/Mips/macro-div.s =================================================================== --- test/MC/Mips/macro-div.s +++ test/MC/Mips/macro-div.s @@ -4,61 +4,201 @@ # RUN: -mattr=+use-tcc-in-div | FileCheck %s --check-prefix=CHECK-TRAP div $25,$11 -# CHECK-NOTRAP: bnez $11, 8 # encoding: [0x15,0x60,0x00,0x02] -# CHECK-NOTRAP: div $zero, $25, $11 # encoding: [0x03,0x2b,0x00,0x1a] -# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] -# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] -# CHECK-NOTRAP: bne $11, $1, 16 # encoding: [0x15,0x61,0x00,0x04] -# CHECK-NOTRAP: lui $1, 32768 # encoding: [0x3c,0x01,0x80,0x00] -# CHECK-NOTRAP: bne $25, $1, 8 # encoding: [0x17,0x21,0x00,0x02] -# CHECK-NOTRAP: nop # encoding: [0x00,0x00,0x00,0x00] -# CHECK-NOTRAP: break 6 # encoding: [0x00,0x06,0x00,0x0d] -# CHECK-NOTRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] +# CHECK-NOTRAP: bnez $11, 8 # encoding: [0x15,0x60,0x00,0x02] +# CHECK-NOTRAP: div $zero, $25, $11 # encoding: [0x03,0x2b,0x00,0x1a] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-NOTRAP: bne $11, $1, 16 # encoding: [0x15,0x61,0x00,0x04] +# CHECK-NOTRAP: lui $1, 32768 # encoding: [0x3c,0x01,0x80,0x00] +# CHECK-NOTRAP: bne $25, $1, 8 # encoding: [0x17,0x21,0x00,0x02] +# CHECK-NOTRAP: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-NOTRAP: break 6 # encoding: [0x00,0x06,0x00,0x0d] +# CHECK-NOTRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] +# CHECK-TRAP: teq $11, $zero, 7 # encoding: [0x01,0x60,0x01,0xf4] +# CHECK-TRAP: div $zero, $25, $11 # encoding: [0x03,0x2b,0x00,0x1a] +# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-TRAP: bne $11, $1, 8 # encoding: [0x15,0x61,0x00,0x02] +# CHECK-TRAP: lui $1, 32768 # encoding: [0x3c,0x01,0x80,0x00] +# CHECK-TRAP: teq $25, $1, 6 # encoding: [0x03,0x21,0x01,0xb4] +# CHECK-TRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] div $24,$12 -# CHECK-NOTRAP: bnez $12, 8 # encoding: [0x15,0x80,0x00,0x02] -# CHECK-NOTRAP: div $zero, $24, $12 # encoding: [0x03,0x0c,0x00,0x1a] -# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] -# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] -# CHECK-NOTRAP: bne $12, $1, 16 # encoding: [0x15,0x81,0x00,0x04] -# CHECK-NOTRAP: lui $1, 32768 # encoding: [0x3c,0x01,0x80,0x00] -# CHECK-NOTRAP: bne $24, $1, 8 # encoding: [0x17,0x01,0x00,0x02] -# CHECK-NOTRAP: nop # encoding: [0x00,0x00,0x00,0x00] -# CHECK-NOTRAP: break 6 # encoding: [0x00,0x06,0x00,0x0d] -# CHECK-NOTRAP: mflo $24 # encoding: [0x00,0x00,0xc0,0x12] +# CHECK-NOTRAP: bnez $12, 8 # encoding: [0x15,0x80,0x00,0x02] +# CHECK-NOTRAP: div $zero, $24, $12 # encoding: [0x03,0x0c,0x00,0x1a] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-NOTRAP: bne $12, $1, 16 # encoding: [0x15,0x81,0x00,0x04] +# CHECK-NOTRAP: lui $1, 32768 # encoding: [0x3c,0x01,0x80,0x00] +# CHECK-NOTRAP: bne $24, $1, 8 # encoding: [0x17,0x01,0x00,0x02] +# CHECK-NOTRAP: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-NOTRAP: break 6 # encoding: [0x00,0x06,0x00,0x0d] +# CHECK-NOTRAP: mflo $24 # encoding: [0x00,0x00,0xc0,0x12] +# CHECK-TRAP: teq $12, $zero, 7 # encoding: [0x01,0x80,0x01,0xf4] +# CHECK-TRAP: div $zero, $24, $12 # encoding: [0x03,0x0c,0x00,0x1a] +# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-TRAP: bne $12, $1, 8 # encoding: [0x15,0x81,0x00,0x02] +# CHECK-TRAP: lui $1, 32768 # encoding: [0x3c,0x01,0x80,0x00] +# CHECK-TRAP: teq $24, $1, 6 # encoding: [0x03,0x01,0x01,0xb4] +# CHECK-TRAP: mflo $24 # encoding: [0x00,0x00,0xc0,0x12] div $25,$0 -# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] - +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] div $0,$9 -# CHECK-NOTRAP: div $zero, $zero, $9 # encoding: [0x00,0x09,0x00,0x1a] +# CHECK-NOTRAP: div $zero, $zero, $9 # encoding: [0x00,0x09,0x00,0x1a] +# CHECK-TRAP: div $zero, $zero, $9 # encoding: [0x00,0x09,0x00,0x1a] div $0,$0 -# CHECK-NOTRAP: div $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1a] - - div $25, $11 -# CHECK-TRAP: teq $11, $zero, 7 # encoding: [0x01,0x60,0x01,0xf4] -# CHECK-TRAP: div $zero, $25, $11 # encoding: [0x03,0x2b,0x00,0x1a] -# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] -# CHECK-TRAP: bne $11, $1, 8 # encoding: [0x15,0x61,0x00,0x02] -# CHECK-TRAP: lui $1, 32768 # encoding: [0x3c,0x01,0x80,0x00] -# CHECK-TRAP: teq $25, $1, 6 # encoding: [0x03,0x21,0x01,0xb4] -# CHECK-TRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] +# CHECK-NOTRAP: div $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1a] +# CHECK-TRAP: div $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1a] - div $24,$12 -# CHECK-TRAP: teq $12, $zero, 7 # encoding: [0x01,0x80,0x01,0xf4] -# CHECK-TRAP: div $zero, $24, $12 # encoding: [0x03,0x0c,0x00,0x1a] -# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] -# CHECK-TRAP: bne $12, $1, 8 # encoding: [0x15,0x81,0x00,0x02] -# CHECK-TRAP: lui $1, 32768 # encoding: [0x3c,0x01,0x80,0x00] -# CHECK-TRAP: teq $24, $1, 6 # encoding: [0x03,0x01,0x01,0xb4] -# CHECK-TRAP: mflo $24 # encoding: [0x00,0x00,0xc0,0x12] - - div $25,$0 -# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] - - div $0,$9 -# CHECK-TRAP: div $zero, $zero, $9 # encoding: [0x00,0x09,0x00,0x1a] - - div $0,$0 -# CHECK-TRAP: div $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1a] + div $4,0 +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] + + div $0,0 +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] + + div $4,1 +# CHECK-NOTRAP: move $4, $4 # encoding: [0x00,0x80,0x20,0x21] +# CHECK-TRAP: move $4, $4 # encoding: [0x00,0x80,0x20,0x21] + + div $4,-1 +# CHECK-NOTRAP: neg $4, $4 # encoding: [0x00,0x04,0x20,0x22] +# CHECK-TRAP: neg $4, $4 # encoding: [0x00,0x04,0x20,0x22] + + div $4,2 +# CHECK-NOTRAP: addiu $1, $zero, 2 # encoding: [0x24,0x01,0x00,0x02] +# CHECK-NOTRAP: div $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1a] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: addiu $1, $zero, 2 # encoding: [0x24,0x01,0x00,0x02] +# CHECK-TRAP: div $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1a] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + div $4,0x8000 +# CHECK-NOTRAP: ori $1, $zero, 32768 # encoding: [0x34,0x01,0x80,0x00] +# CHECK-NOTRAP: div $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1a] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: ori $1, $zero, 32768 # encoding: [0x34,0x01,0x80,0x00] +# CHECK-TRAP: div $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1a] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + div $4,-0x8000 +# CHECK-NOTRAP: addiu $1, $zero, -32768 # encoding: [0x24,0x01,0x80,0x00] +# CHECK-NOTRAP: div $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1a] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: addiu $1, $zero, -32768 # encoding: [0x24,0x01,0x80,0x00] +# CHECK-TRAP: div $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1a] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + div $4,0x10000 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-NOTRAP: div $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1a] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-TRAP: div $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1a] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + div $4,0x1a5a5 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-NOTRAP: ori $1, $1, 42405 # encoding: [0x34,0x21,0xa5,0xa5] +# CHECK-NOTRAP: div $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1a] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-TRAP: ori $1, $1, 42405 # encoding: [0x34,0x21,0xa5,0xa5] +# CHECK-TRAP: div $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1a] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + div $0,$4,$5 +# CHECK-NOTRAP: div $zero, $4, $5 # encoding: [0x00,0x85,0x00,0x1a] +# CHECK-TRAP: div $zero, $4, $5 # encoding: [0x00,0x85,0x00,0x1a] + + div $4,$5,$0 +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] + + div $4,$0,$0 +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] + + div $0,$0,$0 +# CHECK-NOTRAP: div $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1a] +# CHECK-TRAP: div $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1a] + + div $4,$5,$6 +# CHECK-NOTRAP: bnez $6, 8 # encoding: [0x14,0xc0,0x00,0x02] +# CHECK-NOTRAP: div $zero, $5, $6 # encoding: [0x00,0xa6,0x00,0x1a] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-NOTRAP: bne $6, $1, 16 # encoding: [0x14,0xc1,0x00,0x04] +# CHECK-NOTRAP: lui $1, 32768 # encoding: [0x3c,0x01,0x80,0x00] +# CHECK-NOTRAP: bne $5, $1, 8 # encoding: [0x14,0xa1,0x00,0x02] +# CHECK-NOTRAP: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-NOTRAP: break 6 # encoding: [0x00,0x06,0x00,0x0d] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: teq $6, $zero, 7 # encoding: [0x00,0xc0,0x01,0xf4] +# CHECK-TRAP: div $zero, $5, $6 # encoding: [0x00,0xa6,0x00,0x1a] +# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-TRAP: bne $6, $1, 8 # encoding: [0x14,0xc1,0x00,0x02] +# CHECK-TRAP: lui $1, 32768 # encoding: [0x3c,0x01,0x80,0x00] +# CHECK-TRAP: teq $5, $1, 6 # encoding: [0x00,0xa1,0x01,0xb4] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + div $4,$5,0 +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] + + div $4,$0,0 +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] + + div $4,$5,1 +# CHECK-NOTRAP: move $4, $5 # encoding: [0x00,0xa0,0x20,0x21] +# CHECK-TRAP: move $4, $5 # encoding: [0x00,0xa0,0x20,0x21] + + div $4,$5,-1 +# CHECK-NOTRAP: neg $4, $5 # encoding: [0x00,0x05,0x20,0x22] +# CHECK-TRAP: neg $4, $5 # encoding: [0x00,0x05,0x20,0x22] + + div $4,$5,2 +# CHECK-NOTRAP: addiu $1, $zero, 2 # encoding: [0x24,0x01,0x00,0x02] +# CHECK-NOTRAP: div $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1a] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: addiu $1, $zero, 2 # encoding: [0x24,0x01,0x00,0x02] +# CHECK-TRAP: div $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1a] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + div $4,$5,0x8000 +# CHECK-NOTRAP: ori $1, $zero, 32768 # encoding: [0x34,0x01,0x80,0x00] +# CHECK-NOTRAP: div $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1a] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: ori $1, $zero, 32768 # encoding: [0x34,0x01,0x80,0x00] +# CHECK-TRAP: div $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1a] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + div $4,$5,-0x8000 +# CHECK-NOTRAP: addiu $1, $zero, -32768 # encoding: [0x24,0x01,0x80,0x00] +# CHECK-NOTRAP: div $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1a] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: addiu $1, $zero, -32768 # encoding: [0x24,0x01,0x80,0x00] +# CHECK-TRAP: div $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1a] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + div $4,$5,0x10000 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-NOTRAP: div $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1a] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-TRAP: div $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1a] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + div $4,$5,0x1a5a5 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-NOTRAP: ori $1, $1, 42405 # encoding: [0x34,0x21,0xa5,0xa5] +# CHECK-NOTRAP: div $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1a] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-TRAP: ori $1, $1, 42405 # encoding: [0x34,0x21,0xa5,0xa5] +# CHECK-TRAP: div $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1a] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] Index: test/MC/Mips/macro-divu.s =================================================================== --- test/MC/Mips/macro-divu.s +++ test/MC/Mips/macro-divu.s @@ -4,46 +4,187 @@ # RUN: -mattr=+use-tcc-in-div | FileCheck %s --check-prefix=CHECK-TRAP divu $25,$11 -# CHECK-NOTRAP: bnez $11, 8 # encoding: [0x15,0x60,0x00,0x02] -# CHECK-NOTRAP: divu $zero, $25, $11 # encoding: [0x03,0x2b,0x00,0x1b] -# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] -# CHECK-NOTRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] +# CHECK-NOTRAP: bnez $11, 8 # encoding: [0x15,0x60,0x00,0x02] +# CHECK-NOTRAP: divu $zero, $25, $11 # encoding: [0x03,0x2b,0x00,0x1b] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] +# CHECK-TRAP: teq $11, $zero, 7 # encoding: [0x01,0x60,0x01,0xf4] +# CHECK-TRAP: divu $zero, $25, $11 # encoding: [0x03,0x2b,0x00,0x1b] +# CHECK-TRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] divu $24,$12 -# CHECK-NOTRAP: bnez $12, 8 # encoding: [0x15,0x80,0x00,0x02] -# CHECK-NOTRAP: divu $zero, $24, $12 # encoding: [0x03,0x0c,0x00,0x1b] -# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] -# CHECK-NOTRAP: mflo $24 # encoding: [0x00,0x00,0xc0,0x12] +# CHECK-NOTRAP: bnez $12, 8 # encoding: [0x15,0x80,0x00,0x02] +# CHECK-NOTRAP: divu $zero, $24, $12 # encoding: [0x03,0x0c,0x00,0x1b] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: mflo $24 # encoding: [0x00,0x00,0xc0,0x12] +# CHECK-TRAP: teq $12, $zero, 7 # encoding: [0x01,0x80,0x01,0xf4] +# CHECK-TRAP: divu $zero, $24, $12 # encoding: [0x03,0x0c,0x00,0x1b] +# CHECK-TRAP: mflo $24 # encoding: [0x00,0x00,0xc0,0x12] divu $25,$0 -# CHECK-NOTRAP: bnez $zero, 8 # encoding: [0x14,0x00,0x00,0x02] -# CHECK-NOTRAP: divu $zero, $25, $zero # encoding: [0x03,0x20,0x00,0x1b] -# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] -# CHECK-NOTRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] +# CHECK-NOTRAP: bnez $zero, 8 # encoding: [0x14,0x00,0x00,0x02] +# CHECK-NOTRAP: divu $zero, $25, $zero # encoding: [0x03,0x20,0x00,0x1b] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] +# CHECK-TRAP: divu $zero, $25, $zero # encoding: [0x03,0x20,0x00,0x1b] +# CHECK-TRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] divu $0,$9 -# CHECK-NOTRAP: divu $zero, $zero, $9 # encoding: [0x00,0x09,0x00,0x1b] +# CHECK-NOTRAP: divu $zero, $zero, $9 # encoding: [0x00,0x09,0x00,0x1b] +# CHECK-TRAP: divu $zero, $zero, $9 # encoding: [0x00,0x09,0x00,0x1b] divu $0,$0 -# CHECK-NOTRAP: divu $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1b] +# CHECK-NOTRAP: divu $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1b] +# CHECK-TRAP: divu $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1b] - divu $25, $11 -# CHECK-TRAP: teq $11, $zero, 7 # encoding: [0x01,0x60,0x01,0xf4] -# CHECK-TRAP: divu $zero, $25, $11 # encoding: [0x03,0x2b,0x00,0x1b] -# CHECK-TRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] - - divu $24,$12 -# CHECK-TRAP: teq $12, $zero, 7 # encoding: [0x01,0x80,0x01,0xf4] -# CHECK-TRAP: divu $zero, $24, $12 # encoding: [0x03,0x0c,0x00,0x1b] -# CHECK-TRAP: mflo $24 # encoding: [0x00,0x00,0xc0,0x12] - - divu $25,$0 -# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] -# CHECK-TRAP: divu $zero, $25, $zero # encoding: [0x03,0x20,0x00,0x1b] -# CHECK-TRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] - - divu $0,$9 -# CHECK-TRAP: divu $zero, $zero, $9 # encoding: [0x00,0x09,0x00,0x1b] - - divu $0,$0 -# CHECK-TRAP: divu $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1b] + divu $4,0 +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] + + divu $0,0 +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] + + divu $4,1 +# CHECK-NOTRAP: move $4, $4 # encoding: [0x00,0x80,0x20,0x21] +# CHECK-TRAP: move $4, $4 # encoding: [0x00,0x80,0x20,0x21] + + divu $4,-1 +# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-NOTRAP: divu $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1b] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-TRAP: divu $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1b] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + divu $4,2 +# CHECK-NOTRAP: addiu $1, $zero, 2 # encoding: [0x24,0x01,0x00,0x02] +# CHECK-NOTRAP: divu $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1b] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: addiu $1, $zero, 2 # encoding: [0x24,0x01,0x00,0x02] +# CHECK-TRAP: divu $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1b] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + divu $4,0x8000 +# CHECK-NOTRAP: ori $1, $zero, 32768 # encoding: [0x34,0x01,0x80,0x00] +# CHECK-NOTRAP: divu $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1b] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: ori $1, $zero, 32768 # encoding: [0x34,0x01,0x80,0x00] +# CHECK-TRAP: divu $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1b] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + divu $4,-0x8000 +# CHECK-NOTRAP: addiu $1, $zero, -32768 # encoding: [0x24,0x01,0x80,0x00] +# CHECK-NOTRAP: divu $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1b] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: addiu $1, $zero, -32768 # encoding: [0x24,0x01,0x80,0x00] +# CHECK-TRAP: divu $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1b] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + divu $4,0x10000 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-NOTRAP: divu $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1b] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-TRAP: divu $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1b] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + divu $4,0x1a5a5 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-NOTRAP: ori $1, $1, 42405 # encoding: [0x34,0x21,0xa5,0xa5] +# CHECK-NOTRAP: divu $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1b] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-TRAP: ori $1, $1, 42405 # encoding: [0x34,0x21,0xa5,0xa5] +# CHECK-TRAP: divu $zero, $4, $1 # encoding: [0x00,0x81,0x00,0x1b] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + divu $0,$4,$5 +# CHECK-NOTRAP: divu $zero, $4, $5 # encoding: [0x00,0x85,0x00,0x1b] +# CHECK-TRAP: divu $zero, $4, $5 # encoding: [0x00,0x85,0x00,0x1b] + + divu $4,$5,$0 +# CHECK-NOTRAP: bnez $zero, 8 # encoding: [0x14,0x00,0x00,0x02] +# CHECK-NOTRAP: divu $zero, $5, $zero # encoding: [0x00,0xa0,0x00,0x1b] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] +# CHECK-TRAP: divu $zero, $5, $zero # encoding: [0x00,0xa0,0x00,0x1b] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + divu $4,$0,$0 +# CHECK-NOTRAP: bnez $zero, 8 # encoding: [0x14,0x00,0x00,0x02] +# CHECK-NOTRAP: divu $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1b] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] +# CHECK-TRAP: divu $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1b] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + divu $0,$0,$0 +# CHECK-NOTRAP: divu $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1b] +# CHECK-TRAP: divu $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1b] + + divu $4,$5,$6 +# CHECK-NOTRAP: bnez $6, 8 # encoding: [0x14,0xc0,0x00,0x02] +# CHECK-NOTRAP: divu $zero, $5, $6 # encoding: [0x00,0xa6,0x00,0x1b] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: teq $6, $zero, 7 # encoding: [0x00,0xc0,0x01,0xf4] +# CHECK-TRAP: divu $zero, $5, $6 # encoding: [0x00,0xa6,0x00,0x1b] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + divu $4,$5,1 +# CHECK-NOTRAP: move $4, $5 # encoding: [0x00,0xa0,0x20,0x21] +# CHECK-TRAP: move $4, $5 # encoding: [0x00,0xa0,0x20,0x21] + + divu $4,$5,-1 +# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-NOTRAP: divu $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1b] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-TRAP: divu $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1b] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + divu $4,$5,2 +# CHECK-NOTRAP: addiu $1, $zero, 2 # encoding: [0x24,0x01,0x00,0x02] +# CHECK-NOTRAP: divu $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1b] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: addiu $1, $zero, 2 # encoding: [0x24,0x01,0x00,0x02] +# CHECK-TRAP: divu $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1b] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + divu $4,$5,0x8000 +# CHECK-NOTRAP: ori $1, $zero, 32768 # encoding: [0x34,0x01,0x80,0x00] +# CHECK-NOTRAP: divu $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1b] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: ori $1, $zero, 32768 # encoding: [0x34,0x01,0x80,0x00] +# CHECK-TRAP: divu $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1b] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + divu $4,$5,-0x8000 +# CHECK-NOTRAP: addiu $1, $zero, -32768 # encoding: [0x24,0x01,0x80,0x00] +# CHECK-NOTRAP: divu $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1b] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: addiu $1, $zero, -32768 # encoding: [0x24,0x01,0x80,0x00] +# CHECK-TRAP: divu $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1b] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + divu $4,$5,0x10000 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-NOTRAP: divu $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1b] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-TRAP: divu $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1b] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + divu $4,$5,0x1a5a5 +# CHECK-NOTRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-NOTRAP: ori $1, $1, 42405 # encoding: [0x34,0x21,0xa5,0xa5] +# CHECK-NOTRAP: divu $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1b] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] +# CHECK-TRAP: lui $1, 1 # encoding: [0x3c,0x01,0x00,0x01] +# CHECK-TRAP: ori $1, $1, 42405 # encoding: [0x34,0x21,0xa5,0xa5] +# CHECK-TRAP: divu $zero, $5, $1 # encoding: [0x00,0xa1,0x00,0x1b] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] Index: test/MC/Mips/macro-drem.s =================================================================== --- test/MC/Mips/macro-drem.s +++ test/MC/Mips/macro-drem.s @@ -0,0 +1,183 @@ +# 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 + +foo: + 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] +# 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-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + drem $4,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + drem $0,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + drem $4,1 +# CHECK-NOTRAP: addu $4, $zero, $zero # encoding: [0x21,0x20,0x00,0x00] +# CHECK-TRAP: addu $4, $zero, $zero # encoding: [0x21,0x20,0x00,0x00] + + drem $4,-1 +# CHECK-NOTRAP: addu $4, $zero, $zero # encoding: [0x21,0x20,0x00,0x00] +# CHECK-TRAP: 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] +# 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-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] +# 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-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] +# 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-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] +# 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-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] +# 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-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] +# 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 $0,$4,$5 +# CHECK-NOTRAP: ddiv $zero, $4, $5 # encoding: [0x1e,0x00,0x85,0x00] +# CHECK-TRAP: ddiv $zero, $4, $5 # encoding: [0x1e,0x00,0x85,0x00] + + drem $4,$5,$0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + drem $4,$0,$0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + drem $4,$5,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + drem $4,$0,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + drem $0,$4,$5 +# CHECK-NOTRAP: ddiv $zero, $4, $5 # encoding: [0x1e,0x00,0x85,0x00] +# CHECK-TRAP: ddiv $zero, $4, $5 # encoding: [0x1e,0x00,0x85,0x00] + + drem $4,$5,1 +# CHECK-NOTRAP: addu $4, $zero, $zero # encoding: [0x21,0x20,0x00,0x00] +# CHECK-TRAP: addu $4, $zero, $zero # encoding: [0x21,0x20,0x00,0x00] + + drem $4,$5,-1 +# CHECK-NOTRAP: addu $4, $zero, $zero # encoding: [0x21,0x20,0x00,0x00] +# CHECK-TRAP: 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] +# 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-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] +# 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-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] +# 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-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] +# 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-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] +# 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 =================================================================== --- test/MC/Mips/macro-dremu.s +++ test/MC/Mips/macro-dremu.s @@ -0,0 +1,178 @@ +# 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 + +foo: + 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] +# 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-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] +# 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-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + dremu $0,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + dremu $4,1 +# CHECK-NOTRAP: addu $4, $zero, $zero # encoding: [0x21,0x20,0x00,0x00] +# CHECK-TRAP: 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] +# 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-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] +# 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-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] +# 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-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] +# 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-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] +# 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-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] +# 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-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] +# 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-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] +# 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-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] +# 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-NOTRAP: ddivu $zero, $4, $5 # encoding: [0x1f,0x00,0x85,0x00] +# CHECK-TRAP: ddivu $zero, $4, $5 # encoding: [0x1f,0x00,0x85,0x00] + + dremu $4,$5,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + dremu $4,$0,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + dremu $4,$5,1 +# CHECK-NOTRAP: addu $4, $zero, $zero # encoding: [0x21,0x20,0x00,0x00] +# CHECK-TRAP: 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] +# 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-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] +# 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-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] +# 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-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] +# 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-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] +# 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-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] +# 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 =================================================================== --- test/MC/Mips/macro-rem.s +++ test/MC/Mips/macro-rem.s @@ -0,0 +1,175 @@ +# 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 + +foo: + 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] +# 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-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + rem $4,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + rem $0,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + rem $4,1 +# CHECK-NOTRAP: move $4, $zero # encoding: [0x21,0x20,0x00,0x00] +# CHECK-TRAP: move $4, $zero # encoding: [0x21,0x20,0x00,0x00] + + rem $4,-1 +# CHECK-NOTRAP: move $4, $zero # encoding: [0x21,0x20,0x00,0x00] +# CHECK-TRAP: 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] +# 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-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] +# 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-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] +# 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-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] +# 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-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] +# 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-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] +# 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-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + rem $0,$4,$5 +# CHECK-NOTRAP: div $zero, $4, $5 # encoding: [0x1a,0x00,0x85,0x00] +# CHECK-TRAP: div $zero, $4, $5 # encoding: [0x1a,0x00,0x85,0x00] + + rem $4,$0,$0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + rem $4,$5,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + rem $4,$0,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + rem $4,$5,1 +# CHECK-NOTRAP: move $4, $zero # encoding: [0x21,0x20,0x00,0x00] +# CHECK-TRAP: move $4, $zero # encoding: [0x21,0x20,0x00,0x00] + + rem $4,$5,-1 +# CHECK-NOTRAP: move $4, $zero # encoding: [0x21,0x20,0x00,0x00] +# CHECK-TRAP: 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] +# 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-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] +# 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-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] +# 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-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] +# 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-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] +# 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 =================================================================== --- test/MC/Mips/macro-remu.s +++ test/MC/Mips/macro-remu.s @@ -0,0 +1,178 @@ +# 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 + +foo: + 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] +# 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-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] +# 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-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + remu $0,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + remu $4,1 +# CHECK-NOTRAP: move $4, $zero # encoding: [0x21,0x20,0x00,0x00] +# CHECK-TRAP: 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] +# 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-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] +# 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-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] +# 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-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] +# 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-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] +# 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-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] +# 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-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] +# 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 $0,$4,$5 +# CHECK-NOTRAP: divu $zero, $4, $5 # encoding: [0x1b,0x00,0x85,0x00] +# CHECK-TRAP: divu $zero, $4, $5 # encoding: [0x1b,0x00,0x85,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] +# 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-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] +# 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 $4,$5,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + remu $4,$0,0 +# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] + + remu $4,$5,1 +# CHECK-NOTRAP: move $4, $zero # encoding: [0x21,0x20,0x00,0x00] +# CHECK-TRAP: 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] +# 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-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] +# 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-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] +# 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-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] +# 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-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] +# 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-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] +# 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]