From bfcd3690b621d026a4be1d22d6faa92ffff0e8ab Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Sun, 16 Nov 2014 18:37:16 +0100 Subject: [PATCH] x86 jit: Fix+enable quaternion product, optimize "sw zero, *" --- Core/MIPS/x86/CompLoadStore.cpp | 12 +++++++++--- Core/MIPS/x86/CompVFPU.cpp | 10 ++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Core/MIPS/x86/CompLoadStore.cpp b/Core/MIPS/x86/CompLoadStore.cpp index 4884c0057c..a4cb77694f 100644 --- a/Core/MIPS/x86/CompLoadStore.cpp +++ b/Core/MIPS/x86/CompLoadStore.cpp @@ -73,7 +73,8 @@ namespace MIPSComp MIPSGPReg rs = _RS; gpr.Lock(rt, rs); - gpr.MapReg(rt, true, false); + if (bits != 32 || rt != MIPS_REG_ZERO) + gpr.MapReg(rt, true, false); #ifdef _M_IX86 // We use EDX so we can have DL for 8-bit ops. @@ -93,8 +94,13 @@ namespace MIPSComp MOV(32, R(EDX), gpr.R(rt)); MOV(bits, dest, R(EDX)); } - else - MOV(bits, dest, gpr.R(rt)); + else { + if (bits == 32 && rt == MIPS_REG_ZERO) { + MOV(bits, dest, Imm32(0)); + } else { + MOV(bits, dest, gpr.R(rt)); + } + } } if (safe.PrepareSlowWrite()) safe.DoSlowWrite(safeFunc, gpr.R(rt)); diff --git a/Core/MIPS/x86/CompVFPU.cpp b/Core/MIPS/x86/CompVFPU.cpp index 98279215b2..6e8baecc86 100644 --- a/Core/MIPS/x86/CompVFPU.cpp +++ b/Core/MIPS/x86/CompVFPU.cpp @@ -640,12 +640,11 @@ void Jit::Comp_VCrossQuat(MIPSOpcode op) { SUBSS(XMM0, R(XMM1)); MOVSS(fpr.V(dregs[2]), XMM0); } else if (sz == V_Quad) { - // Quaternion product vqmul.q untested - DISABLE; - + // Quaternion product vqmul.q fpr.MapRegsV(sregs, sz, 0); // Compute X + // d[0] = s[0] * t[3] + s[1] * t[2] - s[2] * t[1] + s[3] * t[0]; MOVSS(XMM0, fpr.V(sregs[0])); MULSS(XMM0, fpr.V(tregs[3])); MOVSS(XMM1, fpr.V(sregs[1])); @@ -660,6 +659,7 @@ void Jit::Comp_VCrossQuat(MIPSOpcode op) { MOVSS(fpr.V(dregs[0]), XMM0); // Compute Y + //d[1] = s[1] * t[3] + s[2] * t[0] + s[3] * t[1] - s[0] * t[2]; MOVSS(XMM0, fpr.V(sregs[1])); MULSS(XMM0, fpr.V(tregs[3])); MOVSS(XMM1, fpr.V(sregs[2])); @@ -674,6 +674,7 @@ void Jit::Comp_VCrossQuat(MIPSOpcode op) { MOVSS(fpr.V(dregs[1]), XMM0); // Compute Z + //d[2] = s[0] * t[1] - s[1] * t[0] + s[2] * t[3] + s[3] * t[2]; MOVSS(XMM0, fpr.V(sregs[0])); MULSS(XMM0, fpr.V(tregs[1])); MOVSS(XMM1, fpr.V(sregs[1])); @@ -688,6 +689,7 @@ void Jit::Comp_VCrossQuat(MIPSOpcode op) { MOVSS(fpr.V(dregs[2]), XMM0); // Compute W + //d[3] = -s[0] * t[0] - s[1] * t[1] - s[2] * t[2] + s[3] * t[3]; MOVSS(XMM0, fpr.V(sregs[3])); MULSS(XMM0, fpr.V(tregs[3])); MOVSS(XMM1, fpr.V(sregs[1])); @@ -695,7 +697,7 @@ void Jit::Comp_VCrossQuat(MIPSOpcode op) { SUBSS(XMM0, R(XMM1)); MOVSS(XMM1, fpr.V(sregs[2])); MULSS(XMM1, fpr.V(tregs[2])); - ADDSS(XMM0, R(XMM1)); + SUBSS(XMM0, R(XMM1)); MOVSS(XMM1, fpr.V(sregs[0])); MULSS(XMM1, fpr.V(tregs[0])); SUBSS(XMM0, R(XMM1));