Jit64: boolX - Optimize or for size

OR allows for a more compact representation for constants that can be
represented by a signed 8-bit integer, while MOV does not. By letting
MOV handle the larger constants we can occasionally save a byte.

Before:
45 8B F5             mov         r14d,r13d
41 81 CE 00 80 01 00 or          r14d,18000h

After:
41 BE 00 80 01 00    mov         r14d,18000h
45 0B F5             or          r14d,r13d
This commit is contained in:
Sintendo 2021-01-26 23:37:22 +01:00
parent 62f80a008c
commit 2d3c7fca8d
1 changed files with 11 additions and 2 deletions

View File

@ -783,9 +783,18 @@ void Jit64::boolX(UGeckoInstruction inst)
}
else
{
if (a != j)
if (a == j)
OR(32, Ra, Imm32(imm));
else if (s32(imm) >= -128 && s32(imm) <= 127)
{
MOV(32, Ra, Rj);
OR(32, Ra, Imm32(imm));
OR(32, Ra, Imm32(imm));
}
else
{
MOV(32, Ra, Imm32(imm));
OR(32, Ra, Rj);
}
if (final_not)
{