JitArm64_Integer: subfzex - Optimize a == 0 with in-host carry

Before:
0x52800019   mov    w25, #0x0                 ; =0
0x7a1903f9   ngcs   w25, w25
0x1a9f37f5   cset   w21, hs
0x390bd3b5   strb   w21, [x29, #0x2f4]

After:
0x5a9f23f9   csetm  w25, lo
This commit is contained in:
Sintendo 2026-03-27 00:53:27 +01:00
parent cfa6ec806e
commit 9be878cd28

View File

@ -1326,6 +1326,15 @@ void JitArm64::subfzex(UGeckoInstruction inst)
gpr.SetImmediate(d, imm + carry);
ComputeCarry(Interpreter::Helper_Carry(imm, carry));
}
else if (gpr.IsImm(a, 0) && js.carryFlag == CarryFlag::InHostCarry)
{
gpr.BindToRegister(d, false);
// RD = ~0 + carry = -1 + carry = carry ? 0 : -1
// Note that CSETM sets the destination to -1 if the condition is true,
// and 0 otherwise. Hence, the condition must be carry clear.
CSETM(gpr.R(d), CC_CC);
// Carry remains unchanged.
}
else
{
gpr.BindToRegister(d, d == a);