Jit_Integer: rlwnmx

This commit is contained in:
MerryMage
2018-10-15 21:01:09 +01:00
parent d4e2acc9cd
commit 42614ede16

View File

@ -1690,32 +1690,32 @@ void Jit64::rlwnmx(UGeckoInstruction inst)
int a = inst.RA, b = inst.RB, s = inst.RS; int a = inst.RA, b = inst.RB, s = inst.RS;
const u32 mask = MakeRotationMask(inst.MB, inst.ME); const u32 mask = MakeRotationMask(inst.MB, inst.ME);
if (gpr.R(b).IsImm() && gpr.R(s).IsImm()) if (gpr.IsImm(b, s))
{ {
gpr.SetImmediate32(a, Common::RotateLeft(gpr.R(s).Imm32(), gpr.R(b).Imm32() & 0x1F) & mask); gpr.SetImmediate32(a, Common::RotateLeft(gpr.Imm32(s), gpr.Imm32(b) & 0x1F) & mask);
} }
else else
{ {
// no register choice RCX64Reg ecx = gpr.Scratch(ECX); // no register choice
gpr.FlushLockX(ECX); RCX64Reg Ra = gpr.Bind(a, RCMode::Write);
gpr.Lock(a, b, s); RCOpArg Rb = gpr.Use(b, RCMode::Read);
MOV(32, R(ECX), gpr.R(b)); RCOpArg Rs = gpr.Use(s, RCMode::Read);
gpr.BindToRegister(a, (a == s), true); RegCache::Realize(ecx, Ra, Rb, Rs);
MOV(32, ecx, Rb);
if (a != s) if (a != s)
{ {
MOV(32, gpr.R(a), gpr.R(s)); MOV(32, Ra, Rs);
} }
ROL(32, gpr.R(a), R(ECX)); ROL(32, Ra, ecx);
// we need flags if we're merging the branch // we need flags if we're merging the branch
if (inst.Rc && CheckMergedBranch(0)) if (inst.Rc && CheckMergedBranch(0))
AND(32, gpr.R(a), Imm32(mask)); AND(32, Ra, Imm32(mask));
else else
AndWithMask(gpr.RX(a), mask); AndWithMask(Ra, mask);
} }
if (inst.Rc) if (inst.Rc)
ComputeRC(gpr.R(a), false); ComputeRC(a, false);
gpr.UnlockAll();
gpr.UnlockAllX();
} }
void Jit64::negx(UGeckoInstruction inst) void Jit64::negx(UGeckoInstruction inst)