Jit: Move srawix to ConstantPropagation

This commit is contained in:
JosJuice 2024-08-31 09:55:26 +02:00
parent 0b6b494b8b
commit 42d74f83db
3 changed files with 10 additions and 19 deletions

View File

@ -2561,13 +2561,7 @@ void Jit64::srawix(UGeckoInstruction inst)
int s = inst.RS;
int amount = inst.SH;
if (gpr.IsImm(s))
{
s32 imm = gpr.SImm32(s);
gpr.SetImmediate32(a, imm >> amount);
FinalizeCarry(amount != 0 && imm < 0 && (u32(imm) << (32 - amount)));
}
else if (amount != 0)
if (amount != 0)
{
RCX64Reg Ra = gpr.Bind(a, RCMode::Write);
RCOpArg Rs = gpr.Use(s, RCMode::Read);

View File

@ -757,17 +757,7 @@ void JitArm64::srawix(UGeckoInstruction inst)
int amount = inst.SH;
bool inplace_carry = CanMergeNextInstructions(1) && js.op[1].wantsCAInFlags;
if (gpr.IsImm(s))
{
s32 imm = (s32)gpr.GetImm(s);
gpr.SetImmediate(a, imm >> amount);
ComputeCarry(amount != 0 && (imm < 0) && (u32(imm) << (32 - amount)));
if (inst.Rc)
ComputeRC0(gpr.GetImm(a));
}
else if (amount == 0)
if (amount == 0)
{
gpr.BindToRegister(a, a == s);
ARM64Reg RA = gpr.R(a);

View File

@ -144,6 +144,7 @@ ConstantPropagationResult ConstantPropagation::EvaluateTable31S(UGeckoInstructio
if (!HasGPR(inst.RS))
return {};
std::optional<bool> carry;
u32 a;
const u32 s = GetGPR(inst.RS);
@ -152,6 +153,10 @@ ConstantPropagationResult ConstantPropagation::EvaluateTable31S(UGeckoInstructio
case 26: // cntlzwx
a = std::countl_zero(s);
break;
case 824: // srawix
a = s32(s) >> inst.SH;
carry = inst.SH != 0 && s32(s) < 0 && (s << (32 - inst.SH));
break;
case 922: // extshx
a = s32(s16(s));
break;
@ -162,7 +167,9 @@ ConstantPropagationResult ConstantPropagation::EvaluateTable31S(UGeckoInstructio
return {};
}
return ConstantPropagationResult(inst.RA, a, inst.Rc);
ConstantPropagationResult result(ConstantPropagationResult(inst.RA, a, inst.Rc));
result.carry = carry;
return result;
}
ConstantPropagationResult ConstantPropagation::EvaluateTable31AB(UGeckoInstruction inst,