From 356172bc98760f77f2202a2e057fcdce1a0c0533 Mon Sep 17 00:00:00 2001 From: Sintendo Date: Tue, 26 Jan 2021 22:56:05 +0100 Subject: [PATCH] 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 --- Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp | 13 +++++++++++-- 1 file 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) {