From d5067b62768b0621ad8fe214a9a690aab91050d6 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sun, 28 Sep 2025 15:57:10 +0200 Subject: [PATCH] Jit64: Replace MOVSD with MOVAPD in software FMA Should be a little faster by avoiding false dependencies. Note that there is one remaining MOVSD that really needs to be a MOVSD. --- .../Core/PowerPC/Jit64/Jit_FloatingPoint.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp index 75cfbed3d6..5e7802ff67 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp @@ -443,6 +443,8 @@ void Jit64::fmaddXX(UGeckoInstruction inst) { if (round_input) Force25BitPrecision(XMM1, Rc, XMM2); + else if (Rc.IsSimpleReg()) + MOVAPD(XMM1, Rc); else MOVSD(XMM1, Rc); } @@ -461,8 +463,15 @@ void Jit64::fmaddXX(UGeckoInstruction inst) if (i == 0) { - MOVSD(XMM0, Ra); - MOVSD(XMM2, Rb); + if (Ra.IsSimpleReg()) + MOVAPD(XMM0, Ra); + else + MOVSD(XMM0, Ra); + + if (Rb.IsSimpleReg()) + MOVAPD(XMM2, Rb); + else + MOVSD(XMM2, Rb); } else { @@ -480,9 +489,14 @@ void Jit64::fmaddXX(UGeckoInstruction inst) } if (packed) + { + // result_xmm's upper lane has the result of the first loop iteration MOVSD(R(result_xmm), XMM0); + } else + { DEBUG_ASSERT(result_xmm == XMM0); + } if (madds_accurate_nans) {