Jit64: boolX - Optimize xor for size

XOR 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:
44 89 F7             mov         edi,r14d
81 F7 A0 52 57 01    xor         edi,15752A0h

After:
BF A0 52 57 01       mov         edi,15752A0h
41 33 FE             xor         edi,r14d
This commit is contained in:
Sintendo
2021-01-25 23:44:54 +01:00
parent c3775588df
commit 845d7cd51f

View File

@ -699,11 +699,17 @@ void Jit64::boolX(UGeckoInstruction inst)
MOV(32, Ra, Rj);
NOT(32, Ra);
}
else if (a == j)
XOR(32, Ra, Imm32(imm));
else if (s32(imm) >= -128 && s32(imm) <= 127)
{
MOV(32, Ra, Rj);
XOR(32, Ra, Imm32(imm));
}
else
{
if (a != j)
MOV(32, Ra, Rj);
XOR(32, Ra, Imm32(imm));
MOV(32, Ra, Imm32(imm));
XOR(32, Ra, Rj);
}
}
else if (is_and)