Jit: Move srwx to ConstantPropagation

This commit is contained in:
JosJuice 2024-09-01 10:54:12 +02:00
parent 38eb57420b
commit 4985a01c16
3 changed files with 7 additions and 16 deletions

View File

@ -2204,12 +2204,7 @@ void Jit64::srwx(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)));
}
else if (gpr.IsImm(b))
if (gpr.IsImm(b))
{
u32 amount = gpr.Imm32(b);
if (amount & 0x20)

View File

@ -1632,15 +1632,7 @@ void JitArm64::srwx(UGeckoInstruction inst)
int a = inst.RA, b = inst.RB, s = inst.RS;
if (gpr.IsImm(b) && gpr.IsImm(s))
{
u32 i = gpr.GetImm(s), amount = gpr.GetImm(b);
gpr.SetImmediate(a, (amount & 0x20) ? 0 : i >> (amount & 0x1F));
if (inst.Rc)
ComputeRC0(gpr.GetImm(a));
}
else if (gpr.IsImm(b))
if (gpr.IsImm(b))
{
u32 amount = gpr.GetImm(b);
if (amount & 0x20)

View File

@ -398,6 +398,9 @@ ConstantPropagationResult ConstantPropagation::EvaluateTable31SB(UGeckoInstructi
case 476: // nandx
a = ~(s & b);
break;
case 536: // srwx
a = u32(u64(s) >> b);
break;
default:
return {};
}
@ -413,7 +416,8 @@ ConstantPropagation::EvaluateTable31SBOneRegisterKnown(UGeckoInstruction inst, u
switch (inst.SUBOP10)
{
case 24: // slwx
case 24: // slwx
case 536: // srwx
if (!known_reg_is_b && value == 0)
a = 0;
else if (known_reg_is_b && (value & 0x20))