Jit64: addx - Prefer ADD over LEA when possible
The old logic would always emit LEA when both sources are in a register and OE is disabled. However, ADD is still preferable when one of the sources matches the destination. Before: 45 8D 6C 35 00 lea r13d,[r13+rsi] After: 44 03 EE add r13d,esi
This commit is contained in:
parent
7a6a4510f6
commit
8e7b6f4178
|
@ -1330,18 +1330,21 @@ void Jit64::addx(UGeckoInstruction inst)
|
||||||
RCX64Reg Rd = gpr.Bind(d, RCMode::Write);
|
RCX64Reg Rd = gpr.Bind(d, RCMode::Write);
|
||||||
RegCache::Realize(Ra, Rb, Rd);
|
RegCache::Realize(Ra, Rb, Rd);
|
||||||
|
|
||||||
if (Ra.IsSimpleReg() && Rb.IsSimpleReg() && !inst.OE)
|
if (d == a)
|
||||||
{
|
{
|
||||||
LEA(32, Rd, MRegSum(Ra.GetSimpleReg(), Rb.GetSimpleReg()));
|
ADD(32, Rd, Rb);
|
||||||
}
|
}
|
||||||
else if (d == b)
|
else if (d == b)
|
||||||
{
|
{
|
||||||
ADD(32, Rd, Ra);
|
ADD(32, Rd, Ra);
|
||||||
}
|
}
|
||||||
|
else if (Ra.IsSimpleReg() && Rb.IsSimpleReg() && !inst.OE)
|
||||||
|
{
|
||||||
|
LEA(32, Rd, MRegSum(Ra.GetSimpleReg(), Rb.GetSimpleReg()));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (d != a)
|
MOV(32, Rd, Ra);
|
||||||
MOV(32, Rd, Ra);
|
|
||||||
ADD(32, Rd, Rb);
|
ADD(32, Rd, Rb);
|
||||||
}
|
}
|
||||||
if (inst.OE)
|
if (inst.OE)
|
||||||
|
|
Loading…
Reference in New Issue