From 5749ae09d0447d2c84c8ec5bd3bee09b23c49875 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 10 Mar 2019 20:25:47 -0700 Subject: [PATCH] interp: Correct vmfvc register behavior. The target and source registers were completely wrong. --- Core/MIPS/ARM/ArmCompVFPU.cpp | 10 +++++----- Core/MIPS/ARM64/Arm64CompVFPU.cpp | 10 +++++----- Core/MIPS/IR/IRCompVFPU.cpp | 8 ++++---- Core/MIPS/MIPSIntVFPU.cpp | 8 ++++---- Core/MIPS/x86/CompVFPU.cpp | 10 +++++----- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Core/MIPS/ARM/ArmCompVFPU.cpp b/Core/MIPS/ARM/ArmCompVFPU.cpp index 5b5c6baba3..250c2cc0ac 100644 --- a/Core/MIPS/ARM/ArmCompVFPU.cpp +++ b/Core/MIPS/ARM/ArmCompVFPU.cpp @@ -1333,16 +1333,16 @@ namespace MIPSComp NEON_IF_AVAILABLE(CompNEON_Vmtvc); CONDITIONAL_DISABLE(VFPU_XFER); - int vs = _VS; - int imm = op & 0xFF; + int vd = _VD; + int imm = (op >> 8) & 0xFF; if (imm >= 128 && imm < 128 + VFPU_CTRL_MAX) { - fpr.MapRegV(vs); + fpr.MapRegV(vd); if (imm - 128 == VFPU_CTRL_CC) { gpr.MapReg(MIPS_REG_VFPUCC, 0); - VMOV(fpr.V(vs), gpr.R(MIPS_REG_VFPUCC)); + VMOV(fpr.V(vd), gpr.R(MIPS_REG_VFPUCC)); } else { ADDI2R(SCRATCHREG1, CTXREG, offsetof(MIPSState, vfpuCtrl[0]) + (imm - 128) * 4, SCRATCHREG2); - VLDR(fpr.V(vs), SCRATCHREG1, 0); + VLDR(fpr.V(vd), SCRATCHREG1, 0); } fpr.ReleaseSpillLocksAndDiscardTemps(); } diff --git a/Core/MIPS/ARM64/Arm64CompVFPU.cpp b/Core/MIPS/ARM64/Arm64CompVFPU.cpp index 68428e69d2..1e0382635f 100644 --- a/Core/MIPS/ARM64/Arm64CompVFPU.cpp +++ b/Core/MIPS/ARM64/Arm64CompVFPU.cpp @@ -1066,16 +1066,16 @@ namespace MIPSComp { void Arm64Jit::Comp_Vmfvc(MIPSOpcode op) { CONDITIONAL_DISABLE(VFPU_XFER); - int vs = _VS; - int imm = op & 0xFF; + int vd = _VD; + int imm = (op >> 8) & 0xFF; if (imm >= 128 && imm < 128 + VFPU_CTRL_MAX) { - fpr.MapRegV(vs); + fpr.MapRegV(vd); if (imm - 128 == VFPU_CTRL_CC) { gpr.MapReg(MIPS_REG_VFPUCC, 0); - fp.FMOV(fpr.V(vs), gpr.R(MIPS_REG_VFPUCC)); + fp.FMOV(fpr.V(vd), gpr.R(MIPS_REG_VFPUCC)); } else { ADDI2R(SCRATCH1_64, CTXREG, offsetof(MIPSState, vfpuCtrl[0]) + (imm - 128) * 4, SCRATCH2); - fp.LDR(32, INDEX_UNSIGNED, fpr.V(vs), SCRATCH1_64, 0); + fp.LDR(32, INDEX_UNSIGNED, fpr.V(vd), SCRATCH1_64, 0); } fpr.ReleaseSpillLocksAndDiscardTemps(); } diff --git a/Core/MIPS/IR/IRCompVFPU.cpp b/Core/MIPS/IR/IRCompVFPU.cpp index 16ba587bfb..c13ab20c72 100644 --- a/Core/MIPS/IR/IRCompVFPU.cpp +++ b/Core/MIPS/IR/IRCompVFPU.cpp @@ -1018,13 +1018,13 @@ namespace MIPSComp { CONDITIONAL_DISABLE(VFPU_XFER); // Vector Move from vector control reg (no prefixes) - // S[0] = VFPU_CTRL[i] + // D[0] = VFPU_CTRL[i] - int vs = _VS; - int imm = op & 0xFF; + int vd = _VD; + int imm = (op >> 8) & 0xFF; if (imm >= 128 && imm < 128 + VFPU_CTRL_MAX) { ir.Write(IROp::VfpuCtrlToReg, IRTEMP_0, imm - 128); - ir.Write(IROp::FMovFromGPR, vfpuBase + voffset[vs], IRTEMP_0); + ir.Write(IROp::FMovFromGPR, vfpuBase + voffset[vd], IRTEMP_0); } else { INVALIDOP; } diff --git a/Core/MIPS/MIPSIntVFPU.cpp b/Core/MIPS/MIPSIntVFPU.cpp index ab30fcb8e9..fbc52a018a 100644 --- a/Core/MIPS/MIPSIntVFPU.cpp +++ b/Core/MIPS/MIPSIntVFPU.cpp @@ -1495,7 +1495,7 @@ namespace MIPSInt if (rt != 0) { if (imm < 128) { R(rt) = VI(imm); - } else if (imm < 128 + VFPU_CTRL_MAX) { //mtvc + } else if (imm < 128 + VFPU_CTRL_MAX) { //mfvc R(rt) = currentMIPS->vfpuCtrl[imm - 128]; } else { //ERROR - maybe need to make this value too an "interlock" value? @@ -1526,10 +1526,10 @@ namespace MIPSInt } void Int_Vmfvc(MIPSOpcode op) { - int vs = _VS; - int imm = op & 0xFF; + int vd = _VD; + int imm = (op >> 8) & 0xFF; if (imm >= 128 && imm < 128 + VFPU_CTRL_MAX) { - VI(vs) = currentMIPS->vfpuCtrl[imm - 128]; + VI(vd) = currentMIPS->vfpuCtrl[imm - 128]; } PC += 4; } diff --git a/Core/MIPS/x86/CompVFPU.cpp b/Core/MIPS/x86/CompVFPU.cpp index 8f5d25d294..88ae395642 100644 --- a/Core/MIPS/x86/CompVFPU.cpp +++ b/Core/MIPS/x86/CompVFPU.cpp @@ -2528,15 +2528,15 @@ void Jit::Comp_Mftv(MIPSOpcode op) { void Jit::Comp_Vmfvc(MIPSOpcode op) { CONDITIONAL_DISABLE(VFPU_XFER); - int vs = _VS; - int imm = op & 0xFF; + int vd = _VD; + int imm = (op >> 8) & 0xFF; if (imm >= 128 && imm < 128 + VFPU_CTRL_MAX) { - fpr.MapRegV(vs, MAP_DIRTY | MAP_NOINIT); + fpr.MapRegV(vd, MAP_DIRTY | MAP_NOINIT); if (imm - 128 == VFPU_CTRL_CC) { gpr.MapReg(MIPS_REG_VFPUCC, true, false); - MOVD_xmm(fpr.VX(vs), gpr.R(MIPS_REG_VFPUCC)); + MOVD_xmm(fpr.VX(vd), gpr.R(MIPS_REG_VFPUCC)); } else { - MOVSS(fpr.VX(vs), MIPSSTATE_VAR_ELEM32(vfpuCtrl[0], imm - 128)); + MOVSS(fpr.VX(vd), MIPSSTATE_VAR_ELEM32(vfpuCtrl[0], imm - 128)); } fpr.ReleaseSpillLocks(); }