JitArm64_Integer: subfcx - Subtract shifted 12-bit constant

Eliminate an instruction by encoding the constant in the subtraction,
part two.

Before:
0x52900019   mov    w25, #0x8000              ; =32768
0x6b190359   subs   w25, w26, w25

After:
0x71402359   subs   w25, w26, #0x8, lsl #12   ; =0x8000
This commit is contained in:
Sintendo
2025-08-07 07:51:15 +02:00
parent 45a3e35b06
commit 6a92a90bce
@@ -1451,6 +1451,14 @@ void JitArm64::subfcx(UGeckoInstruction inst)
if (inst.Rc)
ComputeRC0(gpr.R(d));
}
else if (gpr.IsImm(a) && ((gpr.GetImm(a) & 0xFFF000) == gpr.GetImm(a)))
{
gpr.BindToRegister(d, d == b);
CARRY_IF_NEEDED(SUB, SUBS, gpr.R(d), gpr.R(b), gpr.GetImm(a) >> 12, true);
ComputeCarry();
if (inst.Rc)
ComputeRC0(gpr.R(d));
}
else if (gpr.IsImm(b, 0))
{
gpr.BindToRegister(d, d == a);