Jit64: slwx - Handle constant zero input

Shifting zero by any amount always gives zero.

Before:
41 BF 00 00 00 00    mov         r15d,0
8B CF                mov         ecx,edi
49 D3 E7             shl         r15,cl
45 8B FF             mov         r15d,r15d

After:
Nothing, register is set to constant zero.

All games I've tried hit this optimization on launch. In Soul Calibur II
it occurs very frequently during gameplay.
This commit is contained in:
Sintendo 2020-12-13 11:52:21 +01:00
parent 1a52fdf7e3
commit 10d65519f9

View File

@ -1892,6 +1892,12 @@ void Jit64::slwx(UGeckoInstruction inst)
if (inst.Rc)
ComputeRC(a);
}
else if (gpr.IsImm(s) && gpr.Imm32(s) == 0)
{
gpr.SetImmediate32(a, 0);
if (inst.Rc)
ComputeRC(a);
}
else
{
RCX64Reg ecx = gpr.Scratch(ECX); // no register choice