Jit64: srawix - Handle constant input register

Much like we did for srawx. This was already implemented on JitArm64.

Before:
B8 00 00 00 00       mov         eax,0
8B F0                mov         esi,eax
C1 E8 1F             shr         eax,1Fh
23 C6                and         eax,esi
D1 FE                sar         esi,1
88 45 58             mov         byte ptr [rbp+58h],al

After:
C6 45 58 00          mov         byte ptr [rbp+58h],0
This commit is contained in:
Sintendo 2020-11-19 21:20:54 +01:00
parent 8ac40162da
commit cb70d5ee4f
1 changed files with 7 additions and 1 deletions

View File

@ -1995,7 +1995,13 @@ void Jit64::srawix(UGeckoInstruction inst)
int s = inst.RS; int s = inst.RS;
int amount = inst.SH; int amount = inst.SH;
if (amount != 0) if (gpr.IsImm(s))
{
s32 imm = gpr.SImm32(s);
gpr.SetImmediate32(a, imm >> amount);
FinalizeCarry(amount != 0 && imm < 0 && (u32(imm) << (32 - amount)));
}
else if (amount != 0)
{ {
RCX64Reg Ra = gpr.Bind(a, RCMode::Write); RCX64Reg Ra = gpr.Bind(a, RCMode::Write);
RCOpArg Rs = gpr.Use(s, RCMode::Read); RCOpArg Rs = gpr.Use(s, RCMode::Read);