Jit: Move extsXx to ConstantPropagation

This commit is contained in:
JosJuice 2023-08-24 14:17:36 +02:00
parent b833ddc2b6
commit b14c799100
4 changed files with 42 additions and 24 deletions

View File

@ -1026,13 +1026,8 @@ void Jit64::extsXx(UGeckoInstruction inst)
int a = inst.RA, s = inst.RS;
int size = inst.SUBOP10 == 922 ? 16 : 8;
if (gpr.IsImm(s))
{
gpr.SetImmediate32(a, (u32)(s32)(size == 16 ? (s16)gpr.Imm32(s) : (s8)gpr.Imm32(s)));
}
else
{
RCOpArg Rs = gpr.Use(s, RCMode::Read);
RCOpArg Rs = gpr.UseNoImm(s, RCMode::Read);
RCX64Reg Ra = gpr.Bind(a, RCMode::Write);
RegCache::Realize(Rs, Ra);
MOVSX(32, size, Ra, Rs);

View File

@ -510,19 +510,10 @@ void JitArm64::extsXx(UGeckoInstruction inst)
int a = inst.RA, s = inst.RS;
int size = inst.SUBOP10 == 922 ? 16 : 8;
if (gpr.IsImm(s))
{
gpr.SetImmediate(a, (u32)(s32)(size == 16 ? (s16)gpr.GetImm(s) : (s8)gpr.GetImm(s)));
if (inst.Rc)
ComputeRC0(gpr.GetImm(a));
}
else
{
gpr.BindToRegister(a, a == s);
SBFM(gpr.R(a), gpr.R(s), 0, size - 1);
if (inst.Rc)
ComputeRC0(gpr.R(a));
}
gpr.BindToRegister(a, a == s);
SBFM(gpr.R(a), gpr.R(s), 0, size - 1);
if (inst.Rc)
ComputeRC0(gpr.R(a));
}
void JitArm64::cntlzwx(UGeckoInstruction inst)

View File

@ -77,18 +77,49 @@ ConstantPropagationResult ConstantPropagation::EvaluateBitwiseImm(UGeckoInstruct
ConstantPropagationResult ConstantPropagation::EvaluateTable31(UGeckoInstruction inst,
u64 flags) const
{
if (flags & FL_OUT_D)
if (flags & FL_IN_B)
{
// input a, b -> output d
return EvaluateTable31AB(inst, flags);
if (flags & FL_OUT_D)
{
// input a, b -> output d
return EvaluateTable31AB(inst, flags);
}
else
{
// input s, b -> output a
return EvaluateTable31SB(inst);
}
}
else
{
// input s, b -> output a
return EvaluateTable31SB(inst);
// input s -> output a
return EvaluateTable31S(inst);
}
}
ConstantPropagationResult ConstantPropagation::EvaluateTable31S(UGeckoInstruction inst) const
{
if (!HasGPR(inst.RS))
return {};
u32 a;
const u32 s = GetGPR(inst.RS);
switch (inst.SUBOP10)
{
case 922: // extshx
a = s32(s16(s));
break;
case 954: // extsbx
a = s32(s8(s));
break;
default:
return {};
}
return ConstantPropagationResult(inst.RA, a, inst.Rc);
}
ConstantPropagationResult ConstantPropagation::EvaluateTable31AB(UGeckoInstruction inst,
u64 flags) const
{

View File

@ -81,6 +81,7 @@ private:
ConstantPropagationResult EvaluateBitwiseImm(UGeckoInstruction inst,
u32 (*do_op)(u32, u32)) const;
ConstantPropagationResult EvaluateTable31(UGeckoInstruction inst, u64 flags) const;
ConstantPropagationResult EvaluateTable31S(UGeckoInstruction inst) const;
ConstantPropagationResult EvaluateTable31AB(UGeckoInstruction inst, u64 flags) const;
ConstantPropagationResult EvaluateTable31SB(UGeckoInstruction inst) const;
ConstantPropagationResult EvaluateTable31SBOneRegisterKnown(UGeckoInstruction inst, u32 value,