mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-12-16 04:09:39 +00:00
Jit: Move rlwimix to ConstantPropagation
This commit is contained in:
parent
bac911aac4
commit
502317a485
@ -1997,22 +1997,6 @@ void Jit64::rlwimix(UGeckoInstruction inst)
|
||||
int s = inst.RS;
|
||||
|
||||
const u32 mask = MakeRotationMask(inst.MB, inst.ME);
|
||||
|
||||
if (gpr.IsImm(a, s))
|
||||
{
|
||||
gpr.SetImmediate32(a, (gpr.Imm32(a) & ~mask) | (std::rotl(gpr.Imm32(s), inst.SH) & mask));
|
||||
if (inst.Rc)
|
||||
ComputeRC(a);
|
||||
}
|
||||
else if (gpr.IsImm(s) && mask == 0xFFFFFFFF)
|
||||
{
|
||||
gpr.SetImmediate32(a, std::rotl(gpr.Imm32(s), inst.SH));
|
||||
|
||||
if (inst.Rc)
|
||||
ComputeRC(a);
|
||||
}
|
||||
else
|
||||
{
|
||||
const bool left_shift = mask == 0U - (1U << inst.SH);
|
||||
const bool right_shift = mask == (1U << inst.SH) - 1;
|
||||
bool needs_test = false;
|
||||
@ -2125,7 +2109,6 @@ void Jit64::rlwimix(UGeckoInstruction inst)
|
||||
}
|
||||
if (inst.Rc)
|
||||
ComputeRC(a, needs_test);
|
||||
}
|
||||
}
|
||||
|
||||
void Jit64::rlwnmx(UGeckoInstruction inst)
|
||||
|
||||
@ -1975,15 +1975,6 @@ void JitArm64::rlwimix(UGeckoInstruction inst)
|
||||
const u32 width = inst.ME - inst.MB + 1;
|
||||
const u32 rot_dist = inst.SH ? 32 - inst.SH : 0;
|
||||
|
||||
if (gpr.IsImm(a) && gpr.IsImm(s))
|
||||
{
|
||||
u32 res = (gpr.GetImm(a) & ~mask) | (std::rotl(gpr.GetImm(s), inst.SH) & mask);
|
||||
gpr.SetImmediate(a, res);
|
||||
if (inst.Rc)
|
||||
ComputeRC0(res);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mask == 0 || (a == s && inst.SH == 0))
|
||||
{
|
||||
// Do Nothing
|
||||
@ -2044,5 +2035,4 @@ void JitArm64::rlwimix(UGeckoInstruction inst)
|
||||
|
||||
if (inst.Rc)
|
||||
ComputeRC0(gpr.R(a));
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,6 +41,8 @@ ConstantPropagationResult ConstantPropagation::EvaluateInstruction(UGeckoInstruc
|
||||
case 14: // addi
|
||||
case 15: // addis
|
||||
return EvaluateAddImm(inst);
|
||||
case 20: // rlwimix
|
||||
return EvaluateRlwimix(inst);
|
||||
case 21: // rlwinmx
|
||||
return EvaluateRlwinmxRlwnmx(inst, inst.SH);
|
||||
case 23: // rlwnmx
|
||||
@ -114,6 +116,22 @@ ConstantPropagationResult ConstantPropagation::EvaluateAddImmCarry(UGeckoInstruc
|
||||
return result;
|
||||
}
|
||||
|
||||
ConstantPropagationResult ConstantPropagation::EvaluateRlwimix(UGeckoInstruction inst) const
|
||||
{
|
||||
if (!HasGPR(inst.RS))
|
||||
return {};
|
||||
|
||||
const u32 mask = MakeRotationMask(inst.MB, inst.ME);
|
||||
if (mask == 0xFFFFFFFF)
|
||||
return ConstantPropagationResult(inst.RA, std::rotl(GetGPR(inst.RS), inst.SH), inst.Rc);
|
||||
|
||||
if (!HasGPR(inst.RA))
|
||||
return {};
|
||||
|
||||
return ConstantPropagationResult(
|
||||
inst.RA, (GetGPR(inst.RA) & ~mask) | (std::rotl(GetGPR(inst.RS), inst.SH) & mask), inst.Rc);
|
||||
}
|
||||
|
||||
ConstantPropagationResult ConstantPropagation::EvaluateRlwinmxRlwnmx(UGeckoInstruction inst,
|
||||
u32 shift) const
|
||||
{
|
||||
|
||||
@ -81,6 +81,7 @@ private:
|
||||
ConstantPropagationResult EvaluateSubImmCarry(UGeckoInstruction inst) const;
|
||||
ConstantPropagationResult EvaluateAddImm(UGeckoInstruction inst) const;
|
||||
ConstantPropagationResult EvaluateAddImmCarry(UGeckoInstruction inst) const;
|
||||
ConstantPropagationResult EvaluateRlwimix(UGeckoInstruction inst) const;
|
||||
ConstantPropagationResult EvaluateRlwinmxRlwnmx(UGeckoInstruction inst, u32 shift) const;
|
||||
ConstantPropagationResult EvaluateBitwiseImm(UGeckoInstruction inst,
|
||||
u32 (*do_op)(u32, u32)) const;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user