Jit64: srawx - Handle constant zero input
Shifting zero by any amount always gives zero. Before: 41 B9 00 00 00 00 mov r9d,0 41 8B CF mov ecx,r15d 49 C1 E1 20 shl r9,20h 49 D3 F9 sar r9,cl 49 C1 E9 20 shr r9,20h After: Nothing, register is set to constant zero. Before: 41 B8 00 00 00 00 mov r8d,0 41 8B CF mov ecx,r15d 49 C1 E0 20 shl r8,20h 49 D3 F8 sar r8,cl 41 8B C0 mov eax,r8d 49 C1 E8 20 shr r8,20h 44 85 C0 test eax,r8d 0F 95 45 58 setne byte ptr [rbp+58h] After: C6 45 58 00 mov byte ptr [rbp+58h],0 Occurs a bunch of times in Super Mario Sunshine. Since this is an arithmetic shift a similar optimization can be done for constant -1 (0xFFFFFFFF), but I couldn't find any game where this happens.
This commit is contained in:
parent
10d65519f9
commit
67d2fa11f1
|
@ -1983,6 +1983,11 @@ void Jit64::srawx(UGeckoInstruction inst)
|
|||
FinalizeCarry(CC_NZ);
|
||||
}
|
||||
}
|
||||
else if (gpr.IsImm(s) && gpr.Imm32(s) == 0)
|
||||
{
|
||||
gpr.SetImmediate32(a, 0);
|
||||
FinalizeCarry(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
RCX64Reg ecx = gpr.Scratch(ECX); // no register choice
|
||||
|
|
Loading…
Reference in New Issue