diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp index e3dac61ed0..4810e875b3 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp @@ -927,6 +927,16 @@ bool JitArm64::MultiplyImmediate(u32 imm, int a, int d, bool rc) if (rc) ComputeRC0(gpr.R(d)); } + else if (MathUtil::IsPow2(~imm + 2)) + { + // Multiplication by a negative power of two plus one (-(2^n) + 1). + const int shift = IntLog2(~imm + 2); + + gpr.BindToRegister(d, d == a); + SUB(gpr.R(d), gpr.R(a), gpr.R(a), ArithOption(gpr.R(a), ShiftType::LSL, shift)); + if (rc) + ComputeRC0(gpr.R(d)); + } else { // Immediate did not match any known special cases.