From dc4ce58248f910ad1ffd2e46587b08e0f7985f1d Mon Sep 17 00:00:00 2001 From: refractionpcsx2 Date: Sun, 23 Apr 2023 02:08:27 +0100 Subject: [PATCH] VU-JIT: Avoid writeReg stealing loadReg GPR --- pcsx2/x86/microVU_IR.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pcsx2/x86/microVU_IR.h b/pcsx2/x86/microVU_IR.h index 62dc354bf9..ae8e74eed4 100644 --- a/pcsx2/x86/microVU_IR.h +++ b/pcsx2/x86/microVU_IR.h @@ -1015,6 +1015,9 @@ public: microMapGPR& mapI = gprMap[i]; if (mapI.VIreg == viLoadReg) { + // Do this first, there is a case where when loadReg != writeReg, the findFreeGPR can steal the loadReg + gprMap[i].count = this_counter; + if (viWriteReg >= 0) // Reg will be modified { if (viLoadReg != viWriteReg) @@ -1058,7 +1061,7 @@ public: xMOVZX(xRegister32(i), xRegister16(i)); gprMap[i].isZeroExtended = true; } - gprMap[i].count = this_counter; + gprMap[i].isNeeded = true; if (backup)