Jit: Move slwx to ConstantPropagation

This commit is contained in:
JosJuice 2024-09-01 10:49:25 +02:00
parent dc1110e9b9
commit 38eb57420b
3 changed files with 13 additions and 29 deletions

View File

@ -2266,14 +2266,7 @@ void Jit64::slwx(UGeckoInstruction inst)
int b = inst.RB;
int s = inst.RS;
if (gpr.IsImm(b, s))
{
u32 amount = gpr.Imm32(b);
gpr.SetImmediate32(a, (amount & 0x20) ? 0 : gpr.Imm32(s) << (amount & 0x1f));
if (inst.Rc)
ComputeRC(a);
}
else if (gpr.IsImm(b))
if (gpr.IsImm(b))
{
u32 amount = gpr.Imm32(b);
if (amount & 0x20)
@ -2297,12 +2290,6 @@ void Jit64::slwx(UGeckoInstruction inst)
if (inst.Rc)
ComputeRC(a);
}
else if (gpr.IsImm(s) && gpr.Imm32(s) == 0)
{
gpr.SetImmediate32(a, 0);
if (inst.Rc)
ComputeRC(a);
}
else if (cpu_info.bBMI2)
{
RCX64Reg Ra = gpr.Bind(a, RCMode::Write);

View File

@ -1595,21 +1595,7 @@ void JitArm64::slwx(UGeckoInstruction inst)
int a = inst.RA, b = inst.RB, s = inst.RS;
if (gpr.IsImm(b) && gpr.IsImm(s))
{
u32 i = gpr.GetImm(s), j = gpr.GetImm(b);
gpr.SetImmediate(a, (j & 0x20) ? 0 : i << (j & 0x1F));
if (inst.Rc)
ComputeRC0(gpr.GetImm(a));
}
else if (gpr.IsImm(s, 0))
{
gpr.SetImmediate(a, 0);
if (inst.Rc)
ComputeRC0(0);
}
else if (gpr.IsImm(b))
if (gpr.IsImm(b))
{
u32 i = gpr.GetImm(b);
if (i & 0x20)

View File

@ -371,6 +371,9 @@ ConstantPropagationResult ConstantPropagation::EvaluateTable31SB(UGeckoInstructi
switch (inst.SUBOP10)
{
case 24: // slwx
a = u32(u64(s) << b);
break;
case 28: // andx
a = s & b;
break;
@ -410,6 +413,14 @@ ConstantPropagation::EvaluateTable31SBOneRegisterKnown(UGeckoInstruction inst, u
switch (inst.SUBOP10)
{
case 24: // slwx
if (!known_reg_is_b && value == 0)
a = 0;
else if (known_reg_is_b && (value & 0x20))
a = 0;
else
return {};
break;
case 60: // andcx
if (known_reg_is_b)
value = ~value;