[llvm] r336545 - [mips] Addition of the [d]rem and [d]remu instructions
Stefan Maksimovic via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 9 06:06:45 PDT 2018
Author: smaksimovic
Date: Mon Jul 9 06:06:44 2018
New Revision: 336545
URL: http://llvm.org/viewvc/llvm-project?rev=336545&view=rev
Log:
[mips] Addition of the [d]rem and [d]remu instructions
Related to http://reviews.llvm.org/D15772
Depends on http://reviews.llvm.org/D16889
Adds [D]REM[U] instructions.
Patch By: Srdjan Obucina
Contributions from: Simon Dardis
Differential Revision: https://reviews.llvm.org/D17036
Added:
llvm/trunk/test/MC/Mips/macro-drem.s
llvm/trunk/test/MC/Mips/macro-dremu.s
llvm/trunk/test/MC/Mips/macro-rem.s
llvm/trunk/test/MC/Mips/macro-remu.s
Modified:
llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
llvm/trunk/lib/Target/Mips/Mips64InstrInfo.td
llvm/trunk/lib/Target/Mips/MipsInstrInfo.td
llvm/trunk/test/MC/Mips/macro-ddiv.s
Modified: llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp?rev=336545&r1=336544&r2=336545&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp Mon Jul 9 06:06:44 2018
@@ -257,9 +257,9 @@ class MipsAsmParser : public MCTargetAsm
bool expandCondBranches(MCInst &Inst, SMLoc IDLoc, MCStreamer &Out,
const MCSubtargetInfo *STI);
- bool expandDiv(MCInst &Inst, SMLoc IDLoc, MCStreamer &Out,
- const MCSubtargetInfo *STI, const bool IsMips64,
- const bool Signed);
+ bool expandDivRem(MCInst &Inst, SMLoc IDLoc, MCStreamer &Out,
+ const MCSubtargetInfo *STI, const bool IsMips64,
+ const bool Signed);
bool expandTrunc(MCInst &Inst, bool IsDouble, bool Is64FPU, SMLoc IDLoc,
MCStreamer &Out, const MCSubtargetInfo *STI);
@@ -2431,20 +2431,28 @@ MipsAsmParser::tryExpandInstruction(MCIn
return expandCondBranches(Inst, IDLoc, Out, STI) ? MER_Fail : MER_Success;
case Mips::SDivMacro:
case Mips::SDivIMacro:
- return expandDiv(Inst, IDLoc, Out, STI, false, true) ? MER_Fail
- : MER_Success;
+ case Mips::SRemMacro:
+ case Mips::SRemIMacro:
+ return expandDivRem(Inst, IDLoc, Out, STI, false, true) ? MER_Fail
+ : MER_Success;
case Mips::DSDivMacro:
case Mips::DSDivIMacro:
- return expandDiv(Inst, IDLoc, Out, STI, true, true) ? MER_Fail
- : MER_Success;
+ case Mips::DSRemMacro:
+ case Mips::DSRemIMacro:
+ return expandDivRem(Inst, IDLoc, Out, STI, true, true) ? MER_Fail
+ : MER_Success;
case Mips::UDivMacro:
case Mips::UDivIMacro:
- return expandDiv(Inst, IDLoc, Out, STI, false, false) ? MER_Fail
- : MER_Success;
+ case Mips::URemMacro:
+ case Mips::URemIMacro:
+ return expandDivRem(Inst, IDLoc, Out, STI, false, false) ? MER_Fail
+ : MER_Success;
case Mips::DUDivMacro:
case Mips::DUDivIMacro:
- return expandDiv(Inst, IDLoc, Out, STI, true, false) ? MER_Fail
- : MER_Success;
+ case Mips::DURemMacro:
+ case Mips::DURemIMacro:
+ return expandDivRem(Inst, IDLoc, Out, STI, true, false) ? MER_Fail
+ : MER_Success;
case Mips::PseudoTRUNC_W_S:
return expandTrunc(Inst, false, false, IDLoc, Out, STI) ? MER_Fail
: MER_Success;
@@ -3927,9 +3935,9 @@ bool MipsAsmParser::expandCondBranches(M
// The destination register can only be $zero when expanding (S)DivIMacro or
// D(S)DivMacro.
-bool MipsAsmParser::expandDiv(MCInst &Inst, SMLoc IDLoc, MCStreamer &Out,
- const MCSubtargetInfo *STI, const bool IsMips64,
- const bool Signed) {
+bool MipsAsmParser::expandDivRem(MCInst &Inst, SMLoc IDLoc, MCStreamer &Out,
+ const MCSubtargetInfo *STI, const bool IsMips64,
+ const bool Signed) {
MipsTargetStreamer &TOut = getTargetStreamer();
warnIfNoMacro(IDLoc);
@@ -3969,6 +3977,17 @@ bool MipsAsmParser::expandDiv(MCInst &In
bool UseTraps = useTraps();
+ unsigned Opcode = Inst.getOpcode();
+ bool isDiv = Opcode == Mips::SDivMacro || Opcode == Mips::SDivIMacro ||
+ Opcode == Mips::UDivMacro || Opcode == Mips::UDivIMacro ||
+ Opcode == Mips::DSDivMacro || Opcode == Mips::DSDivIMacro ||
+ Opcode == Mips::DUDivMacro || Opcode == Mips::DUDivIMacro;
+
+ bool isRem = Opcode == Mips::SRemMacro || Opcode == Mips::SRemIMacro ||
+ Opcode == Mips::URemMacro || Opcode == Mips::URemIMacro ||
+ Opcode == Mips::DSRemMacro || Opcode == Mips::DSRemIMacro ||
+ Opcode == Mips::DURemMacro || Opcode == Mips::DURemIMacro;
+
if (RtOp.isImm()) {
unsigned ATReg = getATReg(IDLoc);
if (!ATReg)
@@ -3982,10 +4001,13 @@ bool MipsAsmParser::expandDiv(MCInst &In
return false;
}
- if (ImmValue == 1) {
+ if (isRem && (ImmValue == 1 || (Signed && (ImmValue == -1)))) {
+ TOut.emitRRR(Mips::OR, RdReg, ZeroReg, ZeroReg, IDLoc, STI);
+ return false;
+ } else if (isDiv && ImmValue == 1) {
TOut.emitRRR(Mips::OR, RdReg, RsReg, Mips::ZERO, IDLoc, STI);
return false;
- } else if (Signed && ImmValue == -1) {
+ } else if (isDiv && Signed && ImmValue == -1) {
TOut.emitRRR(SubOp, RdReg, ZeroReg, RsReg, IDLoc, STI);
return false;
} else {
@@ -3993,16 +4015,16 @@ bool MipsAsmParser::expandDiv(MCInst &In
false, Inst.getLoc(), Out, STI))
return true;
TOut.emitRR(DivOp, RsReg, ATReg, IDLoc, STI);
- TOut.emitR(Mips::MFLO, RdReg, IDLoc, STI);
+ TOut.emitR(isDiv ? Mips::MFLO : Mips::MFHI, RdReg, IDLoc, STI);
return false;
}
return true;
}
- // If the macro expansion of (d)div(u) would always trap or break, insert
- // the trap/break and exit. This gives a different result to GAS. GAS has
- // an inconsistency/missed optimization in that not all cases are handled
- // equivalently. As the observed behaviour is the same, we're ok.
+ // If the macro expansion of (d)div(u) or (d)rem(u) would always trap or
+ // break, insert the trap/break and exit. This gives a different result to
+ // GAS. GAS has an inconsistency/missed optimization in that not all cases
+ // are handled equivalently. As the observed behaviour is the same, we're ok.
if (RtReg == Mips::ZERO || RtReg == Mips::ZERO_64) {
if (UseTraps) {
TOut.emitRRI(Mips::TEQ, ZeroReg, ZeroReg, 0x7, IDLoc, STI);
@@ -4012,6 +4034,13 @@ bool MipsAsmParser::expandDiv(MCInst &In
return false;
}
+ // (d)rem(u) $0, $X, $Y is a special case. Like div $zero, $X, $Y, it does
+ // not expand to macro sequence.
+ if (isRem && (RdReg == Mips::ZERO || RdReg == Mips::ZERO_64)) {
+ TOut.emitRR(DivOp, RsReg, RtReg, IDLoc, STI);
+ return false;
+ }
+
// Temporary label for first branch traget
MCContext &Context = TOut.getStreamer().getContext();
MCSymbol *BrTarget;
@@ -4035,7 +4064,7 @@ bool MipsAsmParser::expandDiv(MCInst &In
if (!UseTraps)
TOut.getStreamer().EmitLabel(BrTarget);
- TOut.emitR(Mips::MFLO, RdReg, IDLoc, STI);
+ TOut.emitR(isDiv ? Mips::MFLO : Mips::MFHI, RdReg, IDLoc, STI);
return false;
}
@@ -4058,7 +4087,7 @@ bool MipsAsmParser::expandDiv(MCInst &In
if (IsMips64) {
TOut.emitRRI(Mips::ADDiu, ATReg, ZeroReg, 1, IDLoc, STI);
- TOut.emitRRI(Mips::DSLL32, ATReg, ATReg, 0x1f, IDLoc, STI);
+ TOut.emitDSLL(ATReg, ATReg, 63, IDLoc, STI);
} else {
TOut.emitRI(Mips::LUi, ATReg, (uint16_t)0x8000, IDLoc, STI);
}
@@ -4068,12 +4097,12 @@ bool MipsAsmParser::expandDiv(MCInst &In
else {
// Branch to the mflo instruction.
TOut.emitRRX(Mips::BNE, RsReg, ATReg, LabelOpEnd, IDLoc, STI);
- TOut.emitRRI(Mips::SLL, ZeroReg, ZeroReg, 0, IDLoc, STI);
+ TOut.emitNop(IDLoc, STI);
TOut.emitII(Mips::BREAK, 0x6, 0, IDLoc, STI);
}
TOut.getStreamer().EmitLabel(BrTargetEnd);
- TOut.emitR(Mips::MFLO, RdReg, IDLoc, STI);
+ TOut.emitR(isDiv ? Mips::MFLO : Mips::MFHI, RdReg, IDLoc, STI);
return false;
}
Modified: llvm/trunk/lib/Target/Mips/Mips64InstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/Mips64InstrInfo.td?rev=336545&r1=336544&r2=336545&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/Mips64InstrInfo.td (original)
+++ llvm/trunk/lib/Target/Mips/Mips64InstrInfo.td Mon Jul 9 06:06:44 2018
@@ -1032,6 +1032,38 @@ let AdditionalPredicates = [NotInMicroMi
GPR64Opnd:$rd,
imm64:$imm), 0>,
ISA_MIPS3_NOT_32R6_64R6;
+ def DSRemMacro : MipsAsmPseudoInst<(outs GPR64Opnd:$rd),
+ (ins GPR64Opnd:$rs, GPR64Opnd:$rt),
+ "drem\t$rd, $rs, $rt">,
+ ISA_MIPS3_NOT_32R6_64R6;
+ def DSRemIMacro : MipsAsmPseudoInst<(outs GPR64Opnd:$rd),
+ (ins GPR64Opnd:$rs, simm32_relaxed:$imm),
+ "drem\t$rd, $rs, $imm">,
+ ISA_MIPS3_NOT_32R6_64R6;
+ def DURemMacro : MipsAsmPseudoInst<(outs GPR64Opnd:$rd),
+ (ins GPR64Opnd:$rs, GPR64Opnd:$rt),
+ "dremu\t$rd, $rs, $rt">,
+ ISA_MIPS3_NOT_32R6_64R6;
+ def DURemIMacro : MipsAsmPseudoInst<(outs GPR64Opnd:$rd),
+ (ins GPR64Opnd:$rs, simm32_relaxed:$imm),
+ "dremu\t$rd, $rs, $imm">,
+ ISA_MIPS3_NOT_32R6_64R6;
+ def : MipsInstAlias<"drem $rt, $rs", (DSRemMacro GPR64Opnd:$rt,
+ GPR64Opnd:$rt,
+ GPR64Opnd:$rs), 0>,
+ ISA_MIPS3_NOT_32R6_64R6;
+ def : MipsInstAlias<"drem $rd, $imm", (DSRemIMacro GPR64Opnd:$rd,
+ GPR64Opnd:$rd,
+ simm32_relaxed:$imm), 0>,
+ ISA_MIPS3_NOT_32R6_64R6;
+ def : MipsInstAlias<"dremu $rt, $rs", (DURemMacro GPR64Opnd:$rt,
+ GPR64Opnd:$rt,
+ GPR64Opnd:$rs), 0>,
+ ISA_MIPS3_NOT_32R6_64R6;
+ def : MipsInstAlias<"dremu $rd, $imm", (DURemIMacro GPR64Opnd:$rd,
+ GPR64Opnd:$rd,
+ simm32_relaxed:$imm), 0>,
+ ISA_MIPS3_NOT_32R6_64R6;
}
def NORImm64 : NORIMM_DESC_BASE<GPR64Opnd, imm64>, GPR_64;
Modified: llvm/trunk/lib/Target/Mips/MipsInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrInfo.td?rev=336545&r1=336544&r2=336545&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsInstrInfo.td (original)
+++ llvm/trunk/lib/Target/Mips/MipsInstrInfo.td Mon Jul 9 06:06:44 2018
@@ -2950,6 +2950,36 @@ def : MipsInstAlias<"divu $rd, $imm", (U
simm32:$imm), 0>,
ISA_MIPS1_NOT_32R6_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, simm32_relaxed:$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, simm32_relaxed:$imm),
+ "remu\t$rd, $rs, $imm">,
+ ISA_MIPS1_NOT_32R6_64R6;
+
+def : MipsInstAlias<"rem $rt, $rs", (SRemMacro GPR32Opnd:$rt, GPR32Opnd:$rt,
+ GPR32Opnd:$rs), 0>,
+ ISA_MIPS1_NOT_32R6_64R6;
+def : MipsInstAlias<"rem $rd, $imm", (SRemIMacro GPR32Opnd:$rd, GPR32Opnd:$rd,
+ simm32_relaxed:$imm), 0>,
+ ISA_MIPS1_NOT_32R6_64R6;
+def : MipsInstAlias<"remu $rt, $rs", (URemMacro GPR32Opnd:$rt, GPR32Opnd:$rt,
+ GPR32Opnd:$rs), 0>,
+ ISA_MIPS1_NOT_32R6_64R6;
+def : MipsInstAlias<"remu $rd, $imm", (URemIMacro GPR32Opnd:$rd, GPR32Opnd:$rd,
+ simm32_relaxed:$imm), 0>,
+ ISA_MIPS1_NOT_32R6_64R6;
+
def Ulh : MipsAsmPseudoInst<(outs GPR32Opnd:$rt), (ins mem:$addr),
"ulh\t$rt, $addr">; //, ISA_MIPS1_NOT_32R6_64R6;
Modified: llvm/trunk/test/MC/Mips/macro-ddiv.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/macro-ddiv.s?rev=336545&r1=336544&r2=336545&view=diff
==============================================================================
--- llvm/trunk/test/MC/Mips/macro-ddiv.s (original)
+++ llvm/trunk/test/MC/Mips/macro-ddiv.s Mon Jul 9 06:06:44 2018
@@ -16,7 +16,7 @@
# CHECK-NOTRAP: dsll32 $1, $1, 31 # encoding: [0x00,0x01,0x0f,0xfc]
# CHECK-NOTRAP: bne $25, $1, .Ltmp1 # encoding: [0x17,0x21,A,A]
# CHECK-NOTRAP: # fixup A - offset: 0, value: .Ltmp1-4, kind: fixup_Mips_PC16
-# CHECK-NOTRAP: sll $zero, $zero, 0 # encoding: [0x00,0x00,0x00,0x00]
+# CHECK-NOTRAP: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK-NOTRAP: break 6 # encoding: [0x00,0x06,0x00,0x0d]
# CHECK-NOTRAP: .Ltmp1
# CHECK-NOTRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12]
@@ -45,7 +45,7 @@
# CHECK-NOTRAP: dsll32 $1, $1, 31 # encoding: [0x00,0x01,0x0f,0xfc]
# CHECK-NOTRAP: bne $24, $1, .Ltmp3 # encoding: [0x17,0x01,A,A]
# CHECK-NOTRAP: # fixup A - offset: 0, value: .Ltmp3-4, kind: fixup_Mips_PC16
-# CHECK-NOTRAP: sll $zero, $zero, 0 # encoding: [0x00,0x00,0x00,0x00]
+# CHECK-NOTRAP: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK-NOTRAP: break 6 # encoding: [0x00,0x06,0x00,0x0d]
# CHECK-NOTRAP: .Ltmp3
# CHECK-NOTRAP: mflo $24 # encoding: [0x00,0x00,0xc0,0x12]
@@ -211,7 +211,7 @@
# CHECK-NOTRAP: dsll32 $1, $1, 31 # encoding: [0x00,0x01,0x0f,0xfc]
# CHECK-NOTRAP: bne $5, $1, .Ltmp7 # encoding: [0x14,0xa1,A,A]
# CHECK-NOTRAP: # fixup A - offset: 0, value: .Ltmp7-4, kind: fixup_Mips_PC16
-# CHECK-NOTRAP: sll $zero, $zero, 0 # encoding: [0x00,0x00,0x00,0x00]
+# CHECK-NOTRAP: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK-NOTRAP: break 6 # encoding: [0x00,0x06,0x00,0x0d]
# CHECK-NOTRAP: .Ltmp7:
# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12]
Added: llvm/trunk/test/MC/Mips/macro-drem.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/macro-drem.s?rev=336545&view=auto
==============================================================================
--- llvm/trunk/test/MC/Mips/macro-drem.s (added)
+++ llvm/trunk/test/MC/Mips/macro-drem.s Mon Jul 9 06:06:44 2018
@@ -0,0 +1,244 @@
+# RUN: llvm-mc %s -triple=mips64el-unknown-linux -show-encoding -mcpu=mips64 | \
+# RUN: FileCheck %s --check-prefix=CHECK-NOTRAP
+# RUN: llvm-mc %s -triple=mips64el-unknown-linux -show-encoding -mcpu=mips64 \
+# RUN: -mattr=+use-tcc-in-div | FileCheck %s --check-prefix=CHECK-TRAP
+
+ drem $4,$5
+# CHECK-NOTRAP: bne $5, $zero, .Ltmp0 # encoding: [A,A,0xa0,0x14]
+# CHECK-NOTRAP: # fixup A - offset: 0, value: .Ltmp0-4, kind: fixup_Mips_PC16
+# CHECK-NOTRAP: ddiv $zero, $4, $5 # encoding: [0x1e,0x00,0x85,0x00]
+# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00]
+# CHECK-NOTRAP: .Ltmp0
+# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24]
+# CHECK-NOTRAP: bne $5, $1, .Ltmp1 # encoding: [A,A,0xa1,0x14]
+# CHECK-NOTRAP: # fixup A - offset: 0, value: .Ltmp1-4, kind: fixup_Mips_PC16
+# 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, .Ltmp1 # encoding: [A,A,0x81,0x14]
+# CHECK-NOTRAP: # fixup A - offset: 0, value: .Ltmp1-4, kind: fixup_Mips_PC16
+# CHECK-NOTRAP: nop # encoding: [0x00,0x00,0x00,0x00]
+# CHECK-NOTRAP: break 6 # encoding: [0x0d,0x00,0x06,0x00]
+# CHECK-NOTRAP: .Ltmp1
+# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00]
+
+ drem $4,$0
+# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00]
+
+ drem $4,0
+# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00]
+
+ drem $0,0
+# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00]
+
+ drem $4,1
+# CHECK-NOTRAP: or $4, $zero, $zero # encoding: [0x25,0x20,0x00,0x00]
+
+ drem $4,-1
+# CHECK-NOTRAP: or $4, $zero, $zero # encoding: [0x25,0x20,0x00,0x00]
+
+ drem $4,2
+# CHECK-NOTRAP: addiu $1, $zero, 2 # encoding: [0x02,0x00,0x01,0x24]
+# CHECK-NOTRAP: ddiv $zero, $4, $1 # encoding: [0x1e,0x00,0x81,0x00]
+# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00]
+
+ drem $4,0x10000
+# CHECK-NOTRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c]
+# CHECK-NOTRAP: ddiv $zero, $4, $1 # encoding: [0x1e,0x00,0x81,0x00]
+# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00]
+
+ drem $4,0x1a5a5
+# CHECK-NOTRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c]
+# CHECK-NOTRAP: ori $1, $1, 42405 # encoding: [0xa5,0xa5,0x21,0x34]
+# CHECK-NOTRAP: ddiv $zero, $4, $1 # encoding: [0x1e,0x00,0x81,0x00]
+# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00]
+
+ drem $4,0x8000
+# CHECK-NOTRAP: ori $1, $zero, 32768 # encoding: [0x00,0x80,0x01,0x34]
+# CHECK-NOTRAP: ddiv $zero, $4, $1 # encoding: [0x1e,0x00,0x81,0x00]
+# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00]
+
+ drem $4,-0x8000
+# CHECK-NOTRAP: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24]
+# CHECK-NOTRAP: ddiv $zero, $4, $1 # encoding: [0x1e,0x00,0x81,0x00]
+# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00]
+
+ drem $4,$5,$6
+# CHECK-NOTRAP: bne $6, $zero, .Ltmp2 # encoding: [A,A,0xc0,0x14]
+# CHECK-NOTRAP: # fixup A - offset: 0, value: .Ltmp2-4, kind: fixup_Mips_PC16
+# CHECK-NOTRAP: ddiv $zero, $5, $6 # encoding: [0x1e,0x00,0xa6,0x00]
+# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00]
+# CHECK-NOTRAP: .Ltmp2:
+# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24]
+# CHECK-NOTRAP: bne $6, $1, .Ltmp3 # encoding: [A,A,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, .Ltmp3 # encoding: [A,A,0xa1,0x14]
+# CHECK-NOTRAP: nop # encoding: [0x00,0x00,0x00,0x00]
+# CHECK-NOTRAP: break 6 # encoding: [0x0d,0x00,0x06,0x00]
+# CHECK-NOTRAP: .Ltmp3:
+# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00]
+
+ drem $4,$5,$0
+# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00]
+
+ drem $4,$0,$0
+# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00]
+
+ drem $0,$5,$4
+# CHECK-NOTRAP: ddiv $zero, $5, $4 # encoding: [0x1e,0x00,0xa4,0x00]
+
+ drem $4,$5,0
+# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00]
+
+ drem $4,$0,0
+# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00]
+
+ drem $0,$4,$5
+# CHECK-NOTRAP: ddiv $zero, $4, $5 # encoding: [0x1e,0x00,0x85,0x00]
+
+ drem $4,$5,1
+# CHECK-NOTRAP: or $4, $zero, $zero # encoding: [0x25,0x20,0x00,0x00]
+
+ drem $4,$5,-1
+# CHECK-NOTRAP: or $4, $zero, $zero # encoding: [0x25,0x20,0x00,0x00]
+
+ drem $4,$5,2
+# CHECK-NOTRAP: addiu $1, $zero, 2 # encoding: [0x02,0x00,0x01,0x24]
+# CHECK-NOTRAP: ddiv $zero, $5, $1 # encoding: [0x1e,0x00,0xa1,0x00]
+# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00]
+
+ drem $4,$5,0x10000
+# CHECK-NOTRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c]
+# CHECK-NOTRAP: ddiv $zero, $5, $1 # encoding: [0x1e,0x00,0xa1,0x00]
+# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00]
+
+ drem $4,$5,0x1a5a5
+# CHECK-NOTRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c]
+# CHECK-NOTRAP: ori $1, $1, 42405 # encoding: [0xa5,0xa5,0x21,0x34]
+# CHECK-NOTRAP: ddiv $zero, $5, $1 # encoding: [0x1e,0x00,0xa1,0x00]
+# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00]
+
+ drem $4,$5,0x8000
+# CHECK-NOTRAP: ori $1, $zero, 32768 # encoding: [0x00,0x80,0x01,0x34]
+# CHECK-NOTRAP: ddiv $zero, $5, $1 # encoding: [0x1e,0x00,0xa1,0x00]
+# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00]
+
+ drem $4,$5,-0x8000
+# CHECK-NOTRAP: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24]
+# CHECK-NOTRAP: ddiv $zero, $5, $1 # encoding: [0x1e,0x00,0xa1,0x00]
+# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00]
+
+ drem $4,$5
+# CHECK-TRAP: teq $5, $zero, 7 # encoding: [0xf4,0x01,0xa0,0x00]
+# CHECK-TRAP: ddiv $zero, $4, $5 # encoding: [0x1e,0x00,0x85,0x00]
+# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24]
+# CHECK-TRAP: bne $5, $1, .Ltmp2 # encoding: [A,A,0xa1,0x14]
+# CHECK-TRAP: # fixup A - offset: 0, value: .Ltmp2-4, kind: fixup_Mips_PC16
+# 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: .Ltmp2
+# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00]
+
+ drem $4,$0
+# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00]
+
+ drem $4,0
+# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00]
+
+ drem $0,0
+# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00]
+
+ drem $4,1
+# CHECK-TRAP: or $4, $zero, $zero # encoding: [0x25,0x20,0x00,0x00]
+
+ drem $4,-1
+# CHECK-TRAP: or $4, $zero, $zero # encoding: [0x25,0x20,0x00,0x00]
+
+ drem $4,2
+# CHECK-TRAP: addiu $1, $zero, 2 # encoding: [0x02,0x00,0x01,0x24]
+# CHECK-TRAP: ddiv $zero, $4, $1 # encoding: [0x1e,0x00,0x81,0x00]
+# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00]
+
+ drem $4,0x10000
+# CHECK-TRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c]
+# CHECK-TRAP: ddiv $zero, $4, $1 # encoding: [0x1e,0x00,0x81,0x00]
+# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00]
+
+ drem $4,0x1a5a5
+# CHECK-TRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c]
+# CHECK-TRAP: ori $1, $1, 42405 # encoding: [0xa5,0xa5,0x21,0x34]
+# CHECK-TRAP: ddiv $zero, $4, $1 # encoding: [0x1e,0x00,0x81,0x00]
+# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00]
+
+ drem $4,0x8000
+# CHECK-TRAP: ori $1, $zero, 32768 # encoding: [0x00,0x80,0x01,0x34]
+# CHECK-TRAP: ddiv $zero, $4, $1 # encoding: [0x1e,0x00,0x81,0x00]
+# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00]
+
+ drem $4,-0x8000
+# CHECK-TRAP: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24]
+# CHECK-TRAP: ddiv $zero, $4, $1 # encoding: [0x1e,0x00,0x81,0x00]
+# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00]
+
+ drem $4,$5,$6
+# CHECK-TRAP: teq $6, $zero, 7 # encoding: [0xf4,0x01,0xc0,0x00]
+# CHECK-TRAP: ddiv $zero, $5, $6 # encoding: [0x1e,0x00,0xa6,0x00]
+# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24]
+# CHECK-TRAP: bne $6, $1, .Ltmp3 # encoding: [A,A,0xc1,0x14]
+# CHECK-TRAP; # fixup A - offset: 0, value: .Ltmp3-4, kind: fixup_Mips_PC16
+# 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: .Ltmp3
+# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00]
+
+ drem $4,$5,$0
+# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00]
+
+ drem $4,$0,$0
+# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00]
+
+ drem $0,$5,$4
+# CHECK-TRAP: ddiv $zero, $5, $4 # encoding: [0x1e,0x00,0xa4,0x00]
+
+ drem $4,$5,0
+# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00]
+
+ drem $4,$0,0
+# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00]
+
+ drem $0,$4,$5
+# CHECK-TRAP: ddiv $zero, $4, $5 # encoding: [0x1e,0x00,0x85,0x00]
+
+ drem $4,$5,1
+# CHECK-TRAP: or $4, $zero, $zero # encoding: [0x25,0x20,0x00,0x00]
+
+ drem $4,$5,-1
+# CHECK-TRAP: or $4, $zero, $zero # encoding: [0x25,0x20,0x00,0x00]
+
+ drem $4,$5,2
+# CHECK-TRAP: addiu $1, $zero, 2 # encoding: [0x02,0x00,0x01,0x24]
+# CHECK-TRAP: ddiv $zero, $5, $1 # encoding: [0x1e,0x00,0xa1,0x00]
+# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00]
+
+ drem $4,$5,0x10000
+# CHECK-TRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c]
+# CHECK-TRAP: ddiv $zero, $5, $1 # encoding: [0x1e,0x00,0xa1,0x00]
+# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00]
+
+ drem $4,$5,0x1a5a5
+# CHECK-TRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c]
+# CHECK-TRAP: ori $1, $1, 42405 # encoding: [0xa5,0xa5,0x21,0x34]
+# CHECK-TRAP: ddiv $zero, $5, $1 # encoding: [0x1e,0x00,0xa1,0x00]
+# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00]
+
+ drem $4,$5,0x8000
+# CHECK-TRAP: ori $1, $zero, 32768 # encoding: [0x00,0x80,0x01,0x34]
+# CHECK-TRAP: ddiv $zero, $5, $1 # encoding: [0x1e,0x00,0xa1,0x00]
+# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00]
+
+ drem $4,$5,-0x8000
+# CHECK-TRAP: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24]
+# CHECK-TRAP: ddiv $zero, $5, $1 # encoding: [0x1e,0x00,0xa1,0x00]
+# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00]
Added: llvm/trunk/test/MC/Mips/macro-dremu.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/macro-dremu.s?rev=336545&view=auto
==============================================================================
--- llvm/trunk/test/MC/Mips/macro-dremu.s (added)
+++ llvm/trunk/test/MC/Mips/macro-dremu.s Mon Jul 9 06:06:44 2018
@@ -0,0 +1,136 @@
+# RUN: llvm-mc %s -triple=mips64el-unknown-linux -show-encoding -mcpu=mips64 | \
+# RUN: FileCheck %s --check-prefix=CHECK-NOTRAP
+# RUN: llvm-mc %s -triple=mips64el-unknown-linux -show-encoding -mcpu=mips64 \
+# RUN: -mattr=+use-tcc-in-div | FileCheck %s --check-prefix=CHECK-TRAP
+
+ dremu $4,$5
+# CHECK-NOTRAP: bne $5, $zero, .Ltmp0 # encoding: [A,A,0xa0,0x14]
+# CHECK-NOTRAP: # fixup A - offset: 0, value: .Ltmp0-4, kind: fixup_Mips_PC16
+# CHECK-NOTRAP: ddivu $zero, $4, $5 # encoding: [0x1f,0x00,0x85,0x00]
+# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00]
+# CHECK-NOTRAP: .Ltmp0
+# 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: break 7 # encoding: [0x0d,0x00,0x07,0x00]
+# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,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: or $4, $zero, $zero # encoding: [0x25,0x20,0x00,0x00]
+# CHECK-TRAP: or $4, $zero, $zero # encoding: [0x25,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, .Ltmp1 # encoding: [A,A,0xc0,0x14]
+# CHECK-NOTRAP: # fixup A - offset: 0, value: .Ltmp1-4, kind: fixup_Mips_PC16
+# CHECK-NOTRAP: ddivu $zero, $5, $6 # encoding: [0x1f,0x00,0xa6,0x00]
+# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00]
+# CHECK-NOTRAP: .Ltmp1
+# 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: 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 $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 $0,$5,$4
+# CHECK-NOTRAP: ddivu $zero, $5, $4 # encoding: [0x1f,0x00,0xa4,0x00]
+# CHECK-TRAP: ddivu $zero, $5, $4 # encoding: [0x1f,0x00,0xa4,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: or $4, $zero, $zero # encoding: [0x25,0x20,0x00,0x00]
+# CHECK-TRAP: or $4, $zero, $zero # encoding: [0x25,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]
Added: llvm/trunk/test/MC/Mips/macro-rem.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/macro-rem.s?rev=336545&view=auto
==============================================================================
--- llvm/trunk/test/MC/Mips/macro-rem.s (added)
+++ llvm/trunk/test/MC/Mips/macro-rem.s Mon Jul 9 06:06:44 2018
@@ -0,0 +1,187 @@
+# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips32 | \
+# RUN: FileCheck %s --check-prefix=CHECK-NOTRAP
+# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips32 \
+# RUN: -mattr=+use-tcc-in-div | FileCheck %s --check-prefix=CHECK-TRAP
+
+ rem $4,$5
+# CHECK-NOTRAP: bnez $5, $tmp0 # encoding: [A,A,0xa0,0x14]
+# CHECK-NOTRAP: # fixup A - offset: 0, value: ($tmp0)-4, kind: fixup_Mips_PC16
+# CHECK-NOTRAP: div $zero, $4, $5 # encoding: [0x1a,0x00,0x85,0x00]
+# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00]
+# CHECK-NOTRAP: $tmp0
+# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24]
+# CHECK-NOTRAP: bne $5, $1, $tmp1 # encoding: [A,A,0xa1,0x14]
+# CHECK-NOTRAP: # fixup A - offset: 0, value: ($tmp1)-4, kind: fixup_Mips_PC16
+# CHECK-NOTRAP: lui $1, 32768 # encoding: [0x00,0x80,0x01,0x3c]
+# CHECK-NOTRAP: bne $4, $1, $tmp1 # encoding: [A,A,0x81,0x14]
+# CHECK-NOTRAP: # fixup A - offset: 0, value: ($tmp1)-4, kind: fixup_Mips_PC16
+# CHECK-NOTRAP: nop # encoding: [0x00,0x00,0x00,0x00]
+# CHECK-NOTRAP: break 6 # encoding: [0x0d,0x00,0x06,0x00]
+# CHECK-NOTRAP: $tmp1
+# 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, $tmp0 # encoding: [A,A,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: $tmp0
+# 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: [0x25,0x20,0x00,0x00]
+# CHECK-TRAP: move $4, $zero # encoding: [0x25,0x20,0x00,0x00]
+
+ rem $4,-1
+# CHECK-NOTRAP: move $4, $zero # encoding: [0x25,0x20,0x00,0x00]
+# CHECK-TRAP: move $4, $zero # encoding: [0x25,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, $tmp2 # encoding: [A,A,0xc0,0x14]
+# CHECK-NOTRAP: div $zero, $5, $6 # encoding: [0x1a,0x00,0xa6,0x00]
+# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00]
+# CHECk-NOTRAP: $tmp2
+# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24]
+# CHECK-NOTRAP: bne $6, $1, $tmp3 # encoding: [A,A,0xc1,0x14]
+# CHECK-NOTRAP: lui $1, 32768 # encoding: [0x00,0x80,0x01,0x3c]
+# CHECK-NOTRAP: bne $5, $1, $tmp3 # encoding: [A,A,0xa1,0x14]
+# CHECK-NOTRAP: nop # encoding: [0x00,0x00,0x00,0x00]
+# CHECK-NOTRAP: break 6 # encoding: [0x0d,0x00,0x06,0x00]
+# CHECK-NOTRAP: $tmp3
+# 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, $tmp1 # encoding: [A,A,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: $tmp1
+# 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 $4,$0,$0
+# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00]
+# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00]
+
+ rem $0,$5,$4
+# CHECK-NOTRAP: div $zero, $5, $4 # encoding: [0x1a,0x00,0xa4,0x00]
+# CHECK-TRAP: div $zero, $5, $4 # encoding: [0x1a,0x00,0xa4,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: [0x25,0x20,0x00,0x00]
+# CHECK-TRAP: move $4, $zero # encoding: [0x25,0x20,0x00,0x00]
+
+ rem $4,$5,-1
+# CHECK-NOTRAP: move $4, $zero # encoding: [0x25,0x20,0x00,0x00]
+# CHECK-TRAP: move $4, $zero # encoding: [0x25,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]
Added: llvm/trunk/test/MC/Mips/macro-remu.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/macro-remu.s?rev=336545&view=auto
==============================================================================
--- llvm/trunk/test/MC/Mips/macro-remu.s (added)
+++ llvm/trunk/test/MC/Mips/macro-remu.s Mon Jul 9 06:06:44 2018
@@ -0,0 +1,167 @@
+# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips32 | \
+# RUN: FileCheck %s --check-prefix=CHECK-NOTRAP
+# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips32 \
+# RUN: -mattr=+use-tcc-in-div | FileCheck %s --check-prefix=CHECK-TRAP
+
+ remu $4,$5
+# CHECK-NOTRAP: bnez $5, $tmp0 # encoding: [A,A,0xa0,0x14]
+# CHECK-NOTRAP: # fixup A - offset: 0, value: ($tmp0)-4, kind: fixup_Mips_PC16
+# 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: break 7 # encoding: [0x0d,0x00,0x07,0x00]
+# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,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: [0x25,0x20,0x00,0x00]
+# CHECK-TRAP: move $4, $zero # encoding: [0x25,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, $tmp1 # encoding: [A,A,0xc0,0x14]
+# CHECK-NOTRAP: # fixup A - offset: 0, value: ($tmp1)-4, kind: fixup_Mips_PC16
+# CHECK-NOTRAP: divu $zero, $5, $6 # encoding: [0x1b,0x00,0xa6,0x00]
+# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00]
+# CHECK-NOTRAP: $tmp1
+# 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 $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 $0,$5,$4
+# CHECK-NOTRAP: divu $zero, $5, $4 # encoding: [0x1b,0x00,0xa4,0x00]
+# CHECK-TRAP: divu $zero, $5, $4 # encoding: [0x1b,0x00,0xa4,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: [0x25,0x20,0x00,0x00]
+# CHECK-TRAP: move $4, $zero # encoding: [0x25,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]
More information about the llvm-commits
mailing list