JitArm64: Call GetImm before BindToRegister

In case the register we're binding is the same as the immediate register,
we should fetch the immediate before calling BindToRegister. The way
the register cache currently works, calling GetImm after BindToRegister
actually does work, but it's better to not rely on it.
This commit is contained in:
JosJuice 2022-10-01 20:28:39 +02:00
parent 8902d2fe3a
commit 8984777749
1 changed files with 5 additions and 3 deletions

View File

@ -476,9 +476,11 @@ void JitArm64::addx(UGeckoInstruction inst)
{
int imm_reg = gpr.IsImm(a) ? a : b;
int in_reg = gpr.IsImm(a) ? b : a;
int imm_value = gpr.GetImm(imm_reg);
gpr.BindToRegister(d, d == in_reg);
ARM64Reg WA = gpr.GetReg();
ADDI2R(gpr.R(d), gpr.R(in_reg), gpr.GetImm(imm_reg), WA);
ADDI2R(gpr.R(d), gpr.R(in_reg), imm_value, WA);
gpr.Unlock(WA);
if (inst.Rc)
ComputeRC0(gpr.R(d));
@ -745,11 +747,11 @@ void JitArm64::rlwnmx(UGeckoInstruction inst)
}
else if (gpr.IsImm(b))
{
int imm_value = gpr.GetImm(b) & 0x1f;
gpr.BindToRegister(a, a == s);
ARM64Reg WA = gpr.GetReg();
ArithOption Shift(gpr.R(s), ShiftType::ROR, 32 - (gpr.GetImm(b) & 0x1f));
MOVI2R(WA, mask);
AND(gpr.R(a), WA, gpr.R(s), Shift);
AND(gpr.R(a), WA, gpr.R(s), ArithOption(gpr.R(s), ShiftType::ROR, 32 - imm_value));
gpr.Unlock(WA);
if (inst.Rc)
ComputeRC0(gpr.R(a));