mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-12-16 04:09:39 +00:00
Jit: Move negx to ConstantPropagation
This commit is contained in:
parent
92a5a46b2c
commit
4c8995fae5
@ -2283,15 +2283,8 @@ void Jit64::negx(UGeckoInstruction inst)
|
|||||||
int a = inst.RA;
|
int a = inst.RA;
|
||||||
int d = inst.RD;
|
int d = inst.RD;
|
||||||
|
|
||||||
if (gpr.IsImm(a))
|
|
||||||
{
|
{
|
||||||
gpr.SetImmediate32(d, ~(gpr.Imm32(a)) + 1);
|
RCOpArg Ra = gpr.UseNoImm(a, RCMode::Read);
|
||||||
if (inst.OE)
|
|
||||||
GenerateConstantOverflow(gpr.Imm32(d) == 0x80000000);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RCOpArg Ra = gpr.Use(a, RCMode::Read);
|
|
||||||
RCX64Reg Rd = gpr.Bind(d, RCMode::Write);
|
RCX64Reg Rd = gpr.Bind(d, RCMode::Write);
|
||||||
RegCache::Realize(Ra, Rd);
|
RegCache::Realize(Ra, Rd);
|
||||||
|
|
||||||
|
|||||||
@ -534,19 +534,10 @@ void JitArm64::negx(UGeckoInstruction inst)
|
|||||||
|
|
||||||
FALLBACK_IF(inst.OE);
|
FALLBACK_IF(inst.OE);
|
||||||
|
|
||||||
if (gpr.IsImm(a))
|
gpr.BindToRegister(d, d == a);
|
||||||
{
|
SUB(gpr.R(d), ARM64Reg::WSP, gpr.R(a));
|
||||||
gpr.SetImmediate(d, ~((u32)gpr.GetImm(a)) + 1);
|
if (inst.Rc)
|
||||||
if (inst.Rc)
|
ComputeRC0(gpr.R(d));
|
||||||
ComputeRC0(gpr.GetImm(d));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gpr.BindToRegister(d, d == a);
|
|
||||||
SUB(gpr.R(d), ARM64Reg::WSP, gpr.R(a));
|
|
||||||
if (inst.Rc)
|
|
||||||
ComputeRC0(gpr.R(d));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void JitArm64::cmp(UGeckoInstruction inst)
|
void JitArm64::cmp(UGeckoInstruction inst)
|
||||||
|
|||||||
@ -94,11 +94,33 @@ ConstantPropagationResult ConstantPropagation::EvaluateTable31(UGeckoInstruction
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// input s -> output a
|
switch (inst.SUBOP10)
|
||||||
return EvaluateTable31S(inst);
|
{
|
||||||
|
case 104: // negx
|
||||||
|
case 616: // negox
|
||||||
|
// input a -> output d
|
||||||
|
return EvaluateTable31Negx(inst, flags);
|
||||||
|
default:
|
||||||
|
// input s -> output a
|
||||||
|
return EvaluateTable31S(inst);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConstantPropagationResult ConstantPropagation::EvaluateTable31Negx(UGeckoInstruction inst,
|
||||||
|
u64 flags) const
|
||||||
|
{
|
||||||
|
if (!HasGPR(inst.RA))
|
||||||
|
return {};
|
||||||
|
|
||||||
|
const s64 out = -s64(s32(GetGPR(inst.RA)));
|
||||||
|
|
||||||
|
ConstantPropagationResult result(inst.RD, u32(out), inst.Rc);
|
||||||
|
if (flags & FL_SET_OE)
|
||||||
|
result.overflow = (out != s64(s32(out)));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
ConstantPropagationResult ConstantPropagation::EvaluateTable31S(UGeckoInstruction inst) const
|
ConstantPropagationResult ConstantPropagation::EvaluateTable31S(UGeckoInstruction inst) const
|
||||||
{
|
{
|
||||||
if (!HasGPR(inst.RS))
|
if (!HasGPR(inst.RS))
|
||||||
|
|||||||
@ -81,6 +81,7 @@ private:
|
|||||||
ConstantPropagationResult EvaluateBitwiseImm(UGeckoInstruction inst,
|
ConstantPropagationResult EvaluateBitwiseImm(UGeckoInstruction inst,
|
||||||
u32 (*do_op)(u32, u32)) const;
|
u32 (*do_op)(u32, u32)) const;
|
||||||
ConstantPropagationResult EvaluateTable31(UGeckoInstruction inst, u64 flags) const;
|
ConstantPropagationResult EvaluateTable31(UGeckoInstruction inst, u64 flags) const;
|
||||||
|
ConstantPropagationResult EvaluateTable31Negx(UGeckoInstruction inst, u64 flags) const;
|
||||||
ConstantPropagationResult EvaluateTable31S(UGeckoInstruction inst) const;
|
ConstantPropagationResult EvaluateTable31S(UGeckoInstruction inst) const;
|
||||||
ConstantPropagationResult EvaluateTable31AB(UGeckoInstruction inst, u64 flags) const;
|
ConstantPropagationResult EvaluateTable31AB(UGeckoInstruction inst, u64 flags) const;
|
||||||
ConstantPropagationResult EvaluateTable31SB(UGeckoInstruction inst) const;
|
ConstantPropagationResult EvaluateTable31SB(UGeckoInstruction inst) const;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user