JitArm64_Integer: subfcx - Subtract 12-bit constant

Eliminate an instruction by encoding the constant in the subtraction.

Before:
0x5280037a   mov    w26, #0x1b                ; =27
0x6b1a02bb   subs   w27, w21, w26
0x93407f78   sxtw   x24, w27

After:
0x71006ebb   subs   w27, w21, #0x1b
0x93407f7a   sxtw   x26, w27
This commit is contained in:
Sintendo 2025-08-06 01:22:01 +02:00
parent fc9f2d9cea
commit 45a3e35b06

View File

@ -1443,6 +1443,14 @@ void JitArm64::subfcx(UGeckoInstruction inst)
if (inst.Rc)
ComputeRC0(gpr.R(d));
}
else if (gpr.IsImm(a) && ((gpr.GetImm(a) & 0xFFF) == gpr.GetImm(a)))
{
gpr.BindToRegister(d, d == b);
CARRY_IF_NEEDED(SUB, SUBS, gpr.R(d), gpr.R(b), gpr.GetImm(a));
ComputeCarry();
if (inst.Rc)
ComputeRC0(gpr.R(d));
}
else if (gpr.IsImm(b, 0))
{
gpr.BindToRegister(d, d == a);