From c0be34aa814cf6e3f4885c9c2a5e07aba6d7ea32 Mon Sep 17 00:00:00 2001 From: Sintendo Date: Tue, 5 Jan 2021 00:08:35 +0100 Subject: [PATCH] Jit64: subfx - Special case a == b Soul Calibur II does this. Before: 2B F6 sub esi,esi After: Nothing! --- Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp index e90859d270..d018f0604d 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp @@ -941,7 +941,13 @@ void Jit64::subfx(UGeckoInstruction inst) JITDISABLE(bJITIntegerOff); int a = inst.RA, b = inst.RB, d = inst.RD; - if (gpr.IsImm(a) && gpr.IsImm(b)) + if (a == b) + { + gpr.SetImmediate32(d, 0); + if (inst.OE) + GenerateConstantOverflow(false); + } + else if (gpr.IsImm(a, b)) { s32 i = gpr.SImm32(b), j = gpr.SImm32(a); gpr.SetImmediate32(d, i - j);