JitArm64: cmpl - Optimize a == 0 case

By explicitly handling this, we can avoid materializing zero in a
register.

Before:
0x52800019   mov    w25, #0x0
0xb94087b6   ldr    w22, [x29, #0x84]
0xcb16033b   sub    x27, x25, x22

After:
0xb94087b9   ldr    w25, [x29, #0x84]
0xcb1903fb   neg    x27, x25
This commit is contained in:
Bram Speeckaert 2022-11-01 11:10:00 +01:00
parent 5488d3b125
commit dbb8f588c7
1 changed files with 9 additions and 6 deletions

View File

@ -615,16 +615,19 @@ void JitArm64::cmpl(UGeckoInstruction inst)
u64 A = gpr.GetImm(a);
u64 B = gpr.GetImm(b);
MOVI2R(CR, A - B);
return;
}
if (gpr.IsImm(b) && !gpr.GetImm(b))
else if (gpr.IsImm(a) && !gpr.GetImm(a))
{
NEG(CR, EncodeRegTo64(gpr.R(b)));
}
else if (gpr.IsImm(b) && !gpr.GetImm(b))
{
MOV(EncodeRegTo32(CR), gpr.R(a));
return;
}
SUB(gpr.CR(crf), EncodeRegTo64(gpr.R(a)), EncodeRegTo64(gpr.R(b)));
else
{
SUB(CR, EncodeRegTo64(gpr.R(a)), EncodeRegTo64(gpr.R(b)));
}
}
void JitArm64::cmpi(UGeckoInstruction inst)