mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-22 22:05:38 +00:00
CPU/Recompiler/AArch32: Reduce register usage of Mul
This commit is contained in:
parent
23dff0a9b6
commit
cce1ec598c
|
@ -665,20 +665,23 @@ void CodeGenerator::EmitCmp(HostReg to_reg, const Value& value)
|
|||
void CodeGenerator::EmitMul(HostReg to_reg_hi, HostReg to_reg_lo, const Value& lhs, const Value& rhs,
|
||||
bool signed_multiply)
|
||||
{
|
||||
Value lhs_in_reg = GetValueInHostRegister(lhs);
|
||||
Value rhs_in_reg = GetValueInHostRegister(rhs);
|
||||
// We could use GetValueInHostRegister() here, but we run out of registers...
|
||||
// Value lhs_in_reg = GetValueInHostRegister(lhs);
|
||||
// Value rhs_in_reg = GetValueInHostRegister(rhs);
|
||||
const HostReg lhs_in_reg = lhs.IsInHostRegister() ? lhs.GetHostRegister() : (EmitCopyValue(RARG1, lhs), RARG1);
|
||||
const HostReg rhs_in_reg = rhs.IsInHostRegister() ? rhs.GetHostRegister() : (EmitCopyValue(RARG2, rhs), RARG2);
|
||||
|
||||
if (lhs.size < RegSize_64)
|
||||
{
|
||||
if (signed_multiply)
|
||||
{
|
||||
m_emit->smull(GetHostReg32(to_reg_lo), GetHostReg32(to_reg_hi), GetHostReg32(lhs_in_reg.host_reg),
|
||||
GetHostReg32(rhs_in_reg.host_reg));
|
||||
m_emit->smull(GetHostReg32(to_reg_lo), GetHostReg32(to_reg_hi), GetHostReg32(lhs_in_reg),
|
||||
GetHostReg32(rhs_in_reg));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_emit->umull(GetHostReg32(to_reg_lo), GetHostReg32(to_reg_hi), GetHostReg32(lhs_in_reg.host_reg),
|
||||
GetHostReg32(rhs_in_reg.host_reg));
|
||||
m_emit->umull(GetHostReg32(to_reg_lo), GetHostReg32(to_reg_hi), GetHostReg32(lhs_in_reg),
|
||||
GetHostReg32(rhs_in_reg));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue