From a438791e7c250e61409c1fe658b75a6dbd340633 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 18 Feb 2013 23:21:18 -0800 Subject: [PATCH] Initial (very inefficient) vmmov for x86 jit. This makes #464 work (at least LittleBigPlanet), but only in x86 jit. --- Core/MIPS/ARM/ArmCompVFPU.cpp | 4 ++++ Core/MIPS/ARM/ArmJit.h | 1 + Core/MIPS/MIPSTables.cpp | 2 +- Core/MIPS/x86/CompVFPU.cpp | 42 +++++++++++++++++++++++++++++++++++ Core/MIPS/x86/Jit.h | 1 + 5 files changed, 49 insertions(+), 1 deletion(-) diff --git a/Core/MIPS/ARM/ArmCompVFPU.cpp b/Core/MIPS/ARM/ArmCompVFPU.cpp index 79a30cf52c..ca909fe193 100644 --- a/Core/MIPS/ARM/ArmCompVFPU.cpp +++ b/Core/MIPS/ARM/ArmCompVFPU.cpp @@ -63,4 +63,8 @@ namespace MIPSComp DISABLE; } + void Comp_Vmmov(u32 op) { + DISABLE; + } + } diff --git a/Core/MIPS/ARM/ArmJit.h b/Core/MIPS/ARM/ArmJit.h index 80a6a0d3c4..194c557139 100644 --- a/Core/MIPS/ARM/ArmJit.h +++ b/Core/MIPS/ARM/ArmJit.h @@ -116,6 +116,7 @@ public: void Comp_VV2Op(u32 op); void Comp_Mftv(u32 op); void Comp_Vmtvc(u32 op); + void Comp_Vmmov(u32 op); ArmJitBlockCache *GetBlockCache() { return &blocks; } diff --git a/Core/MIPS/MIPSTables.cpp b/Core/MIPS/MIPSTables.cpp index 1dde164e39..ed6be36317 100644 --- a/Core/MIPS/MIPSTables.cpp +++ b/Core/MIPS/MIPSTables.cpp @@ -669,7 +669,7 @@ const MIPSInstruction tableVFPU6[32] = //111100 xxx const MIPSInstruction tableVFPUMatrixSet1[16] = //111100 11100 0xxxx (rm x is 16) { - INSTR("vmmov",&Jit::Comp_Generic, Dis_MatrixSet2, Int_Vmmov, IS_VFPU|OUT_EAT_PREFIX), + INSTR("vmmov",&Jit::Comp_Vmmov, Dis_MatrixSet2, Int_Vmmov, IS_VFPU|OUT_EAT_PREFIX), {-2}, {-2}, INSTR("vmidt",&Jit::Comp_Generic, Dis_MatrixSet1, Int_VMatrixInit, IS_VFPU|OUT_EAT_PREFIX), diff --git a/Core/MIPS/x86/CompVFPU.cpp b/Core/MIPS/x86/CompVFPU.cpp index 6928a57f01..928684fae9 100644 --- a/Core/MIPS/x86/CompVFPU.cpp +++ b/Core/MIPS/x86/CompVFPU.cpp @@ -693,4 +693,46 @@ void Jit::Comp_Vmtvc(u32 op) { } } +void Jit::Comp_Vmmov(u32 op) { + CONDITIONAL_DISABLE; + + // TODO: This probably ignores prefixes? + if (js.MayHavePrefix()) + DISABLE; + + MatrixSize sz = GetMtxSize(op); + int n = GetMatrixSide(sz); + + u8 sregs[16], dregs[16]; + GetMatrixRegs(sregs, sz, _VS); + GetMatrixRegs(dregs, sz, _VD); + + // TODO: gas doesn't allow overlap, what does the PSP do? + // Potentially detect overlap or the safe direction to move in, or just DISABLE? + // This is very not optimal, blows the regcache everytime. + u8 tempregs[16]; + for (int a = 0; a < n; a++) + { + for (int b = 0; b < n; b++) + { + u8 temp = (u8) fpr.GetTempV(); + fpr.MapRegV(temp, MAP_NOINIT | MAP_DIRTY); + MOVSS(fpr.VX(temp), fpr.V(sregs[a * 4 + b])); + fpr.StoreFromRegisterV(temp); + tempregs[a * 4 + b] = temp; + } + } + for (int a = 0; a < n; a++) + { + for (int b = 0; b < n; b++) + { + u8 temp = tempregs[a * 4 + b]; + fpr.MapRegV(temp, 0); + MOVSS(fpr.V(dregs[a * 4 + b]), fpr.VX(temp)); + } + } + + fpr.ReleaseSpillLocks(); +} + } \ No newline at end of file diff --git a/Core/MIPS/x86/Jit.h b/Core/MIPS/x86/Jit.h index dc5082ff81..54c443b53a 100644 --- a/Core/MIPS/x86/Jit.h +++ b/Core/MIPS/x86/Jit.h @@ -191,6 +191,7 @@ public: void Comp_VV2Op(u32 op); void Comp_Mftv(u32 op); void Comp_Vmtvc(u32 op); + void Comp_Vmmov(u32 op); void Comp_DoNothing(u32 op);