mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-12-16 04:09:39 +00:00
Jit: Move addicx to ConstantPropagation
Note: Jit64 didn't support immediate handling for addic before.
This commit is contained in:
parent
a3797778ff
commit
1eea610375
@ -871,30 +871,16 @@ void JitArm64::addic(UGeckoInstruction inst)
|
||||
int a = inst.RA, d = inst.RD;
|
||||
bool rc = inst.OPCD == 13;
|
||||
s32 simm = inst.SIMM_16;
|
||||
u32 imm = (u32)simm;
|
||||
|
||||
if (gpr.IsImm(a))
|
||||
gpr.BindToRegister(d, d == a);
|
||||
{
|
||||
u32 i = gpr.GetImm(a);
|
||||
gpr.SetImmediate(d, i + imm);
|
||||
|
||||
bool has_carry = Interpreter::Helper_Carry(i, imm);
|
||||
ComputeCarry(has_carry);
|
||||
if (rc)
|
||||
ComputeRC0(gpr.GetImm(d));
|
||||
auto WA = gpr.GetScopedReg();
|
||||
CARRY_IF_NEEDED(ADDI2R, ADDSI2R, gpr.R(d), gpr.R(a), simm, WA);
|
||||
}
|
||||
else
|
||||
{
|
||||
gpr.BindToRegister(d, d == a);
|
||||
{
|
||||
auto WA = gpr.GetScopedReg();
|
||||
CARRY_IF_NEEDED(ADDI2R, ADDSI2R, gpr.R(d), gpr.R(a), simm, WA);
|
||||
}
|
||||
|
||||
ComputeCarry();
|
||||
if (rc)
|
||||
ComputeRC0(gpr.R(d));
|
||||
}
|
||||
ComputeCarry();
|
||||
if (rc)
|
||||
ComputeRC0(gpr.R(d));
|
||||
}
|
||||
|
||||
bool JitArm64::MultiplyImmediate(u32 imm, int a, int d, bool rc)
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
#include <bit>
|
||||
|
||||
#include "Core/PowerPC/Gekko.h"
|
||||
#include "Core/PowerPC/Interpreter/Interpreter.h"
|
||||
#include "Core/PowerPC/PPCTables.h"
|
||||
|
||||
namespace JitCommon
|
||||
@ -30,6 +31,9 @@ ConstantPropagationResult ConstantPropagation::EvaluateInstruction(UGeckoInstruc
|
||||
{
|
||||
switch (inst.OPCD)
|
||||
{
|
||||
case 12: // addic
|
||||
case 13: // addic.
|
||||
return EvaluateAddImmCarry(inst);
|
||||
case 14: // addi
|
||||
case 15: // addis
|
||||
return EvaluateAddImm(inst);
|
||||
@ -69,6 +73,19 @@ ConstantPropagationResult ConstantPropagation::EvaluateAddImm(UGeckoInstruction
|
||||
return ConstantPropagationResult(inst.RD, m_gpr_values[inst.RA] + immediate);
|
||||
}
|
||||
|
||||
ConstantPropagationResult ConstantPropagation::EvaluateAddImmCarry(UGeckoInstruction inst) const
|
||||
{
|
||||
if (!HasGPR(inst.RA))
|
||||
return {};
|
||||
|
||||
const u32 a = m_gpr_values[inst.RA];
|
||||
const bool rc = inst.OPCD & 1;
|
||||
|
||||
ConstantPropagationResult result(inst.RD, a + inst.SIMM_16, rc);
|
||||
result.carry = Interpreter::Helper_Carry(a, inst.SIMM_16);
|
||||
return result;
|
||||
}
|
||||
|
||||
ConstantPropagationResult ConstantPropagation::EvaluateRlwinmxRlwnmx(UGeckoInstruction inst,
|
||||
u32 shift) const
|
||||
{
|
||||
|
||||
@ -78,6 +78,7 @@ public:
|
||||
|
||||
private:
|
||||
ConstantPropagationResult EvaluateAddImm(UGeckoInstruction inst) const;
|
||||
ConstantPropagationResult EvaluateAddImmCarry(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