Jit64: subfx - Use LEA when possible

Similar to what we do for addx. Since we're calculating b - a and
because subtraction is not communitative, we can only apply this when
source register a holds the constant.

Before:
45 8B EE             mov         r13d,r14d
41 83 ED 08          sub         r13d,8

After:
45 8D 6E F8          lea         r13d,[r14-8]
This commit is contained in:
Sintendo 2020-04-19 23:53:56 +02:00
parent 89646c898f
commit 19dda51a0d
1 changed files with 4 additions and 0 deletions

View File

@ -932,6 +932,10 @@ void Jit64::subfx(UGeckoInstruction inst)
MOV(32, Rd, Rb);
SUB(32, Rd, R(RSCRATCH));
}
else if (Rb.IsSimpleReg() && Ra.IsImm() && !inst.OE)
{
LEA(32, Rd, MDisp(Rb.GetSimpleReg(), -Ra.SImm32()));
}
else
{
MOV(32, Rd, Rb);