Fixing rdx clobber from mul/div.
This commit is contained in:
parent
bca349b302
commit
ae02dc7eba
|
@ -1994,6 +1994,7 @@ table->AddSequence(OPCODE_MUL, [](X64Emitter& e, Instr*& i) {
|
|||
e.imul(src);
|
||||
}
|
||||
e.mov(dest_src, Nax);
|
||||
ReloadRDX(e);
|
||||
}, [](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
// RAX = value, RDX = clobbered
|
||||
// TODO(benvanik): make the register allocator put dest_src in RAX?
|
||||
|
@ -2007,6 +2008,7 @@ table->AddSequence(OPCODE_MUL, [](X64Emitter& e, Instr*& i) {
|
|||
e.imul(Ndx);
|
||||
}
|
||||
e.mov(dest_src, Nax);
|
||||
ReloadRDX(e);
|
||||
});
|
||||
} else if (IsFloatType(i->dest->type)) {
|
||||
XmmBinaryOp(e, i, i->flags, [](X64Emitter& e, Instr& i, const Xmm& dest_src, const Xmm& src) {
|
||||
|
@ -2043,6 +2045,7 @@ table->AddSequence(OPCODE_MUL_HI, [](X64Emitter& e, Instr*& i) {
|
|||
e.imul(src);
|
||||
}
|
||||
e.mov(dest_src, Ndx);
|
||||
ReloadRDX(e);
|
||||
}, [](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
// RAX = value, RDX = clobbered
|
||||
// TODO(benvanik): make the register allocator put dest_src in RAX?
|
||||
|
@ -2056,6 +2059,7 @@ table->AddSequence(OPCODE_MUL_HI, [](X64Emitter& e, Instr*& i) {
|
|||
e.imul(Ndx);
|
||||
}
|
||||
e.mov(dest_src, Ndx);
|
||||
ReloadRDX(e);
|
||||
});
|
||||
} else {
|
||||
UNIMPLEMENTED_SEQ();
|
||||
|
@ -2077,6 +2081,7 @@ table->AddSequence(OPCODE_DIV, [](X64Emitter& e, Instr*& i) {
|
|||
e.idiv(src);
|
||||
}
|
||||
e.mov(dest_src, Nax);
|
||||
ReloadRDX(e);
|
||||
}, [](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
// RAX = value, RDX = clobbered
|
||||
// TODO(benvanik): make the register allocator put dest_src in RAX?
|
||||
|
@ -2090,6 +2095,7 @@ table->AddSequence(OPCODE_DIV, [](X64Emitter& e, Instr*& i) {
|
|||
e.idiv(Ndx);
|
||||
}
|
||||
e.mov(dest_src, Nax);
|
||||
ReloadRDX(e);
|
||||
});
|
||||
} else if (IsFloatType(i->dest->type)) {
|
||||
XmmBinaryOp(e, i, i->flags, [](X64Emitter& e, Instr& i, const Xmm& dest_src, const Xmm& src) {
|
||||
|
|
|
@ -73,6 +73,10 @@ void CallNative(X64Emitter& e, void* target) {
|
|||
e.mov(e.rdx, e.qword[e.rcx + 8]); // membase
|
||||
}
|
||||
|
||||
void ReloadRDX(X64Emitter& e) {
|
||||
e.mov(e.rdx, e.qword[e.rcx + 8]); // membase
|
||||
}
|
||||
|
||||
// Sets EFLAGs with zf for the given value.
|
||||
// ZF = 1 if false, 0 = true (so jz = jump if false)
|
||||
void CheckBoolean(X64Emitter& e, Value* v) {
|
||||
|
|
Loading…
Reference in New Issue