mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-12-16 04:09:39 +00:00
Jit: Move slwx to ConstantPropagation
This commit is contained in:
parent
45760841b2
commit
bb645e6cbb
@ -2266,14 +2266,7 @@ void Jit64::slwx(UGeckoInstruction inst)
|
|||||||
int b = inst.RB;
|
int b = inst.RB;
|
||||||
int s = inst.RS;
|
int s = inst.RS;
|
||||||
|
|
||||||
if (gpr.IsImm(b, s))
|
if (gpr.IsImm(b))
|
||||||
{
|
|
||||||
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))
|
|
||||||
{
|
{
|
||||||
u32 amount = gpr.Imm32(b);
|
u32 amount = gpr.Imm32(b);
|
||||||
if (amount & 0x20)
|
if (amount & 0x20)
|
||||||
@ -2297,12 +2290,6 @@ void Jit64::slwx(UGeckoInstruction inst)
|
|||||||
if (inst.Rc)
|
if (inst.Rc)
|
||||||
ComputeRC(a);
|
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)
|
else if (cpu_info.bBMI2)
|
||||||
{
|
{
|
||||||
RCX64Reg Ra = gpr.Bind(a, RCMode::Write);
|
RCX64Reg Ra = gpr.Bind(a, RCMode::Write);
|
||||||
|
|||||||
@ -1799,21 +1799,7 @@ void JitArm64::slwx(UGeckoInstruction inst)
|
|||||||
|
|
||||||
int a = inst.RA, b = inst.RB, s = inst.RS;
|
int a = inst.RA, b = inst.RB, s = inst.RS;
|
||||||
|
|
||||||
if (gpr.IsImm(b) && gpr.IsImm(s))
|
if (gpr.IsImm(b))
|
||||||
{
|
|
||||||
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))
|
|
||||||
{
|
{
|
||||||
u32 i = gpr.GetImm(b);
|
u32 i = gpr.GetImm(b);
|
||||||
if (i & 0x20)
|
if (i & 0x20)
|
||||||
|
|||||||
@ -371,6 +371,9 @@ ConstantPropagationResult ConstantPropagation::EvaluateTable31SB(UGeckoInstructi
|
|||||||
|
|
||||||
switch (inst.SUBOP10)
|
switch (inst.SUBOP10)
|
||||||
{
|
{
|
||||||
|
case 24: // slwx
|
||||||
|
a = u32(u64(s) << (b & 0x3f));
|
||||||
|
break;
|
||||||
case 28: // andx
|
case 28: // andx
|
||||||
a = s & b;
|
a = s & b;
|
||||||
break;
|
break;
|
||||||
@ -410,6 +413,14 @@ ConstantPropagation::EvaluateTable31SBOneRegisterKnown(UGeckoInstruction inst, u
|
|||||||
|
|
||||||
switch (inst.SUBOP10)
|
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
|
case 60: // andcx
|
||||||
if (known_reg_is_b)
|
if (known_reg_is_b)
|
||||||
value = ~value;
|
value = ~value;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user