From 2d3c7fca8d26f434b14a79d26884a7825ddc8547 Mon Sep 17 00:00:00 2001 From: Sintendo Date: Tue, 26 Jan 2021 23:37:22 +0100 Subject: [PATCH] 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 --- 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 b2a76be60e..19d090c7c1 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp @@ -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) {