Jit64: subfx - Special case a == b

Soul Calibur II does this.

Before:
2B F6                sub         esi,esi

After:
Nothing!
This commit is contained in:
Sintendo 2021-01-05 00:08:35 +01:00
parent b0be20560f
commit c0be34aa81

View File

@ -941,7 +941,13 @@ void Jit64::subfx(UGeckoInstruction inst)
JITDISABLE(bJITIntegerOff);
int a = inst.RA, b = inst.RB, d = inst.RD;
if (gpr.IsImm(a) && gpr.IsImm(b))
if (a == b)
{
gpr.SetImmediate32(d, 0);
if (inst.OE)
GenerateConstantOverflow(false);
}
else if (gpr.IsImm(a, b))
{
s32 i = gpr.SImm32(b), j = gpr.SImm32(a);
gpr.SetImmediate32(d, i - j);