From 761e269e5fbeaae6bd74fe82cde167a0a17d4c8a Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 8 Nov 2014 12:38:08 -0800 Subject: [PATCH] x86jit: Avoid some regcache pollution. --- Core/MIPS/x86/CompVFPU.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Core/MIPS/x86/CompVFPU.cpp b/Core/MIPS/x86/CompVFPU.cpp index f841470678..036e883daf 100644 --- a/Core/MIPS/x86/CompVFPU.cpp +++ b/Core/MIPS/x86/CompVFPU.cpp @@ -1805,9 +1805,15 @@ void Jit::Comp_Mftv(MIPSOpcode op) { // rt = 0, imm = 255 appears to be used as a CPU interlock by some games. if (rt != MIPS_REG_ZERO) { if (imm < 128) { //R(rt) = VI(imm); - fpr.MapRegV(imm, 0); // TODO: Seems the V register becomes dirty here? It shouldn't. - gpr.MapReg(rt, false, true); - MOVD_xmm(gpr.R(rt), fpr.VX(imm)); + if (fpr.V(imm).IsSimpleReg()) { + fpr.MapRegV(imm, 0); + gpr.MapReg(rt, false, true); + MOVD_xmm(gpr.R(rt), fpr.VX(imm)); + } else { + // Let's not bother mapping the vreg. + gpr.MapReg(rt, false, true); + MOV(32, gpr.R(rt), fpr.V(imm)); + } } else if (imm < 128 + VFPU_CTRL_MAX) { //mfvc if (imm - 128 == VFPU_CTRL_CC) { if (gpr.IsImm(MIPS_REG_VFPUCC)) { @@ -1834,8 +1840,8 @@ void Jit::Comp_Mftv(MIPSOpcode op) { case 7: //mtv if (imm < 128) { // VI(imm) = R(rt); - fpr.MapRegV(imm, MAP_DIRTY | MAP_NOINIT); // TODO: Seems the V register becomes dirty here? It shouldn't. - gpr.MapReg(rt, true, false); + fpr.MapRegV(imm, MAP_DIRTY | MAP_NOINIT); + // Let's not bother mapping rt if we don't have to. MOVD_xmm(fpr.VX(imm), gpr.R(rt)); } else if (imm < 128 + VFPU_CTRL_MAX) { //mtvc //currentMIPS->vfpuCtrl[imm - 128] = R(rt); if (imm - 128 == VFPU_CTRL_CC) {