CPU/Recompiler: Fix bad codegen on slti where rd==rs

This commit is contained in:
Connor McLaughlin 2019-12-12 00:00:48 +10:00
parent aafac96f34
commit 18066239b7
1 changed files with 8 additions and 3 deletions

View File

@ -1218,6 +1218,10 @@ bool CodeGenerator::Compile_SetLess(const CodeBlockInstruction& cbi)
dest = cbi.instruction.i.rt; dest = cbi.instruction.i.rt;
lhs = m_register_cache.ReadGuestRegister(cbi.instruction.i.rs, true, true); lhs = m_register_cache.ReadGuestRegister(cbi.instruction.i.rs, true, true);
rhs = Value::FromConstantU32(cbi.instruction.i.imm_sext32()); rhs = Value::FromConstantU32(cbi.instruction.i.imm_sext32());
// flush the old value which might free up a register
if (dest != cbi.instruction.r.rs)
m_register_cache.InvalidateGuestRegister(dest);
} }
else else
{ {
@ -1225,10 +1229,11 @@ bool CodeGenerator::Compile_SetLess(const CodeBlockInstruction& cbi)
dest = cbi.instruction.r.rd; dest = cbi.instruction.r.rd;
lhs = m_register_cache.ReadGuestRegister(cbi.instruction.r.rs, true, true); lhs = m_register_cache.ReadGuestRegister(cbi.instruction.r.rs, true, true);
rhs = m_register_cache.ReadGuestRegister(cbi.instruction.r.rt); rhs = m_register_cache.ReadGuestRegister(cbi.instruction.r.rt);
}
// flush the old value which might free up a register // flush the old value which might free up a register
m_register_cache.InvalidateGuestRegister(dest); if (dest != cbi.instruction.i.rs && dest != cbi.instruction.r.rt)
m_register_cache.InvalidateGuestRegister(dest);
}
Value result = m_register_cache.AllocateScratch(RegSize_32); Value result = m_register_cache.AllocateScratch(RegSize_32);
EmitCmp(lhs.host_reg, rhs); EmitCmp(lhs.host_reg, rhs);