JitArm64_Integer: subfzex - Constant folding

When both the input register and the carry flag are constants, the
result can be precomputed.

Before:
0x52800016   mov    w22, #0x0                 ; =0
0x2a3603f6   mvn    w22, w22

After:
This commit is contained in:
Sintendo 2024-12-28 20:57:55 +01:00
parent fa13457abb
commit 7410bc2025

View File

@ -1359,6 +1359,15 @@ void JitArm64::subfzex(UGeckoInstruction inst)
int a = inst.RA, d = inst.RD;
if (gpr.IsImm(a) && HasConstantCarry())
{
const u32 imm = ~gpr.GetImm(a);
const u32 carry = js.carryFlag == CarryFlag::ConstantTrue;
gpr.SetImmediate(d, imm + carry);
ComputeCarry(Interpreter::Helper_Carry(imm, carry));
}
else
{
gpr.BindToRegister(d, d == a);
switch (js.carryFlag)
@ -1393,6 +1402,7 @@ void JitArm64::subfzex(UGeckoInstruction inst)
break;
}
}
}
if (inst.Rc)
ComputeRC0(gpr.R(d));