From 19dda51a0d34d9b26d8ef38139a81079b21633b4 Mon Sep 17 00:00:00 2001 From: Sintendo Date: Sun, 19 Apr 2020 23:53:56 +0200 Subject: [PATCH] Jit64: subfx - Use LEA when possible Similar to what we do for addx. Since we're calculating b - a and because subtraction is not communitative, we can only apply this when source register a holds the constant. Before: 45 8B EE mov r13d,r14d 41 83 ED 08 sub r13d,8 After: 45 8D 6E F8 lea r13d,[r14-8] --- Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp index 8b5c7d95ad..99b66d83fe 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp @@ -932,6 +932,10 @@ void Jit64::subfx(UGeckoInstruction inst) MOV(32, Rd, Rb); SUB(32, Rd, R(RSCRATCH)); } + else if (Rb.IsSimpleReg() && Ra.IsImm() && !inst.OE) + { + LEA(32, Rd, MDisp(Rb.GetSimpleReg(), -Ra.SImm32())); + } else { MOV(32, Rd, Rb);