summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorSintendo <bram.speeckaert@gmail.com>2021-01-26 22:56:05 +0100
committerSintendo <bram.speeckaert@gmail.com>2021-01-28 23:16:48 +0100
commit356172bc98760f77f2202a2e057fcdce1a0c0533 (patch)
treee00e10a5f2da81619479675d03c1ee889ee5b390 /Source
parentb760a56a9abd4fdda2f2809f0ad8e7d861c7a2a8 (diff)
Jit64: boolX - Optimize and for size
AND 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: 41 8B FE mov edi,r14d 81 E7 FF FE FF FF and edi,0FFFFFEFFh After: BF FF FE FF FF mov edi,0FFFFFEFFh 41 23 FE and edi,r14d
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp
index 7b16d335f0..7bca28fd4b 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp
@@ -739,9 +739,18 @@ void Jit64::boolX(UGeckoInstruction inst)
}
else
{
- if (a != j)
+ if (a == j)
+ AND(32, Ra, Imm32(imm));
+ else if (s32(imm) >= -128 && s32(imm) <= 127)
+ {
MOV(32, Ra, Rj);
- AND(32, Ra, Imm32(imm));
+ AND(32, Ra, Imm32(imm));
+ }
+ else
+ {
+ MOV(32, Ra, Imm32(imm));
+ AND(32, Ra, Rj);
+ }
if (final_not)
{