mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-12-16 04:09:39 +00:00
Jit: Move subfic to ConstantPropagation
This commit is contained in:
parent
204a8fbd53
commit
c7d8a0b276
@ -1042,14 +1042,6 @@ void Jit64::subfic(UGeckoInstruction inst)
|
||||
JITDISABLE(bJITIntegerOff);
|
||||
int a = inst.RA, d = inst.RD, imm = inst.SIMM_16;
|
||||
|
||||
if (gpr.IsImm(a))
|
||||
{
|
||||
u32 i = imm, j = gpr.Imm32(a);
|
||||
gpr.SetImmediate32(d, i - j);
|
||||
FinalizeCarry(j == 0 || (i > j - 1));
|
||||
return;
|
||||
}
|
||||
|
||||
RCOpArg Ra = gpr.Use(a, RCMode::Read);
|
||||
RCX64Reg Rd = gpr.Bind(d, RCMode::Write);
|
||||
RegCache::Realize(Ra, Rd);
|
||||
|
||||
@ -1381,15 +1381,6 @@ void JitArm64::subfic(UGeckoInstruction inst)
|
||||
int a = inst.RA, d = inst.RD;
|
||||
s32 imm = inst.SIMM_16;
|
||||
|
||||
if (gpr.IsImm(a))
|
||||
{
|
||||
u32 a_imm = gpr.GetImm(a);
|
||||
|
||||
gpr.SetImmediate(d, imm - a_imm);
|
||||
ComputeCarry(a_imm == 0 || Interpreter::Helper_Carry(imm, 0u - a_imm));
|
||||
}
|
||||
else
|
||||
{
|
||||
const bool will_read = d == a;
|
||||
gpr.BindToRegister(d, will_read);
|
||||
ARM64Reg RD = gpr.R(d);
|
||||
@ -1420,7 +1411,6 @@ void JitArm64::subfic(UGeckoInstruction inst)
|
||||
ComputeCarry();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void JitArm64::addex(UGeckoInstruction inst)
|
||||
{
|
||||
|
||||
@ -33,6 +33,8 @@ ConstantPropagationResult ConstantPropagation::EvaluateInstruction(UGeckoInstruc
|
||||
{
|
||||
case 7: // mulli
|
||||
return EvaluateMulImm(inst);
|
||||
case 8: // subfic
|
||||
return EvaluateSubImmCarry(inst);
|
||||
case 12: // addic
|
||||
case 13: // addic.
|
||||
return EvaluateAddImmCarry(inst);
|
||||
@ -73,6 +75,19 @@ ConstantPropagationResult ConstantPropagation::EvaluateMulImm(UGeckoInstruction
|
||||
return ConstantPropagationResult(inst.RD, m_gpr_values[inst.RA] * inst.SIMM_16);
|
||||
}
|
||||
|
||||
ConstantPropagationResult ConstantPropagation::EvaluateSubImmCarry(UGeckoInstruction inst) const
|
||||
{
|
||||
if (!HasGPR(inst.RA))
|
||||
return {};
|
||||
|
||||
const u32 a = GetGPR(inst.RA);
|
||||
const u32 imm = s32(inst.SIMM_16);
|
||||
|
||||
ConstantPropagationResult result(inst.RD, imm - a);
|
||||
result.carry = imm >= a;
|
||||
return result;
|
||||
}
|
||||
|
||||
ConstantPropagationResult ConstantPropagation::EvaluateAddImm(UGeckoInstruction inst) const
|
||||
{
|
||||
const s32 immediate = inst.OPCD & 1 ? inst.SIMM_16 << 16 : inst.SIMM_16;
|
||||
|
||||
@ -78,6 +78,7 @@ public:
|
||||
|
||||
private:
|
||||
ConstantPropagationResult EvaluateMulImm(UGeckoInstruction inst) const;
|
||||
ConstantPropagationResult EvaluateSubImmCarry(UGeckoInstruction inst) const;
|
||||
ConstantPropagationResult EvaluateAddImm(UGeckoInstruction inst) const;
|
||||
ConstantPropagationResult EvaluateAddImmCarry(UGeckoInstruction inst) const;
|
||||
ConstantPropagationResult EvaluateRlwinmxRlwnmx(UGeckoInstruction inst, u32 shift) const;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user