Commit 6163c62f by Srdjan Obucina Committed by Jim Stichnoth

Subzero, MIPS32: DIVU instruction encoding

Implements DIVU instruction encoding R=stichnot@chromium.org Review URL: https://codereview.chromium.org/2377733002 . Patch from Srdjan Obucina <Srdjan.Obucina@imgtec.com>.
parent 175cb138
......@@ -537,6 +537,11 @@ void AssemblerMIPS32::div_s(const Operand *OpFd, const Operand *OpFs,
emitCOP1FmtFtFsFd(Opcode, SinglePrecision, OpFd, OpFs, OpFt, "div.s");
}
void AssemblerMIPS32::divu(const Operand *OpRs, const Operand *OpRt) {
static constexpr IValueT Opcode = 0x0000001B;
emitRsRt(Opcode, OpRs, OpRt, "divu");
}
void AssemblerMIPS32::lui(const Operand *OpRt, const uint16_t Imm) {
IValueT Opcode = 0x3C000000;
const IValueT Rt = encodeGPRegister(OpRt, "Rt", "lui");
......
......@@ -163,6 +163,8 @@ public:
void div_s(const Operand *OpFd, const Operand *OpFs, const Operand *OpFt);
void divu(const Operand *OpRs, const Operand *OpRt);
void lui(const Operand *OpRt, const uint16_t Imm);
void lw(const Operand *OpRt, const Operand *OpBase, const uint32_t Offset);
......
......@@ -912,6 +912,11 @@ template <> void InstMIPS32Div_s::emitIAS(const Cfg *Func) const {
Asm->div_s(getDest(), getSrc(0), getSrc(1));
}
template <> void InstMIPS32Divu::emitIAS(const Cfg *Func) const {
auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>();
Asm->divu(getDest(), getSrc(0));
}
template <> void InstMIPS32Lui::emitIAS(const Cfg *Func) const {
auto *Asm = Func->getAssembler<MIPS32::AssemblerMIPS32>();
auto *C32 = llvm::dyn_cast<ConstantInteger32>(getSrc(0));
......
......@@ -1270,6 +1270,7 @@ template <> void InstMIPS32Cvt_s_w::emitIAS(const Cfg *Func) const;
template <> void InstMIPS32Div::emitIAS(const Cfg *Func) const;
template <> void InstMIPS32Div_d::emitIAS(const Cfg *Func) const;
template <> void InstMIPS32Div_s::emitIAS(const Cfg *Func) const;
template <> void InstMIPS32Divu::emitIAS(const Cfg *Func) const;
template <> void InstMIPS32Lui::emit(const Cfg *Func) const;
template <> void InstMIPS32Lui::emitIAS(const Cfg *Func) const;
template <> void InstMIPS32Lw::emitIAS(const Cfg *Func) const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment