From 12fcbac2a32a9b97b72f919a7f25b76dda7532b1 Mon Sep 17 00:00:00 2001 From: Sintendo Date: Sun, 5 Jan 2020 23:28:04 +0100 Subject: [PATCH] Jit64: addx - Emit LEA for register + immediate Prefer LEA over MOV + ADD when dealing with immediates. Before: 44 8B EE mov r13d,esi 41 83 C5 20 add r13d,20h After: 44 8D 6E 20 lea r13d,[rsi+20h] --- Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp index 25b27e465b..494969b71f 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp @@ -1342,6 +1342,14 @@ void Jit64::addx(UGeckoInstruction inst) { LEA(32, Rd, MRegSum(Ra.GetSimpleReg(), Rb.GetSimpleReg())); } + else if (Ra.IsSimpleReg() && Rb.IsImm() && !inst.OE) + { + LEA(32, Rd, MDisp(Ra.GetSimpleReg(), Rb.SImm32())); + } + else if (Rb.IsSimpleReg() && Ra.IsImm() && !inst.OE) + { + LEA(32, Rd, MDisp(Rb.GetSimpleReg(), Ra.SImm32())); + } else { MOV(32, Rd, Ra);