From 936d80b21464c37bc932b4f2db011aaa1ea8d4d7 Mon Sep 17 00:00:00 2001 From: raven02 Date: Thu, 20 Dec 2012 21:39:10 +0800 Subject: [PATCH] Implement Vscmp --- Core/MIPS/MIPSIntVFPU.cpp | 27 ++++++++++++++++++++++++++- Core/MIPS/MIPSIntVFPU.h | 1 + Core/MIPS/MIPSTables.cpp | 2 +- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/Core/MIPS/MIPSIntVFPU.cpp b/Core/MIPS/MIPSIntVFPU.cpp index b3045b9a4b..1cb7fc4167 100644 --- a/Core/MIPS/MIPSIntVFPU.cpp +++ b/Core/MIPS/MIPSIntVFPU.cpp @@ -1321,7 +1321,32 @@ namespace MIPSInt PC += 4; EatPrefixes(); } - + + void Int_Vscmp(u32 op) { + int vt = _VT; + int vs = _VS; + int vd = _VD; + VectorSize sz = GetVecSize(op); + float s[4]; + float t[4]; + float d[4]; + ReadVector(s, sz, vs); + ApplySwizzleS(s, sz); + ReadVector(t, sz, vt); + ApplySwizzleT(t, sz); + int n = GetNumVectorElements(sz); + for (int i = 0; i < n ; i++) { + int a=s[i] - t[i]; + if (a > 0) d[i]=1; + else if (a < 0) d[i]=-1; + else d[i]=0; + } + ApplyPrefixD(d, sz); + WriteVector(d, sz, vd); + PC += 4; + EatPrefixes(); + } + void Int_Vsge(u32 op) { int vt = _VT; int vs = _VS; diff --git a/Core/MIPS/MIPSIntVFPU.h b/Core/MIPS/MIPSIntVFPU.h index 50e7229366..73165eb2fe 100644 --- a/Core/MIPS/MIPSIntVFPU.h +++ b/Core/MIPS/MIPSIntVFPU.h @@ -49,6 +49,7 @@ namespace MIPSInt void Int_Vidt(u32 op); void Int_Vcmp(u32 op); void Int_Vminmax(u32 op); + void Int_Vscmp(u32 op); void Int_Vcrs(u32 op); void Int_Vcmov(u32 op); void Int_CrossQuat(u32 op); diff --git a/Core/MIPS/MIPSTables.cpp b/Core/MIPS/MIPSTables.cpp index 67d9b70e92..c73bceaf07 100644 --- a/Core/MIPS/MIPSTables.cpp +++ b/Core/MIPS/MIPSTables.cpp @@ -506,7 +506,7 @@ MIPSInstruction tableVFPU3[8] = //011011 xxx INSTR("vmin",&Jit::Comp_Generic, Dis_VectorSet3, Int_Vminmax, IS_VFPU), INSTR("vmax",&Jit::Comp_Generic, Dis_VectorSet3, Int_Vminmax, IS_VFPU), {-2}, - INSTR("vscmp",&Jit::Comp_Generic, Dis_Generic, 0, IS_VFPU), + INSTR("vscmp",&Jit::Comp_Generic, Dis_VectorSet3, Int_Vscmp, IS_VFPU), INSTR("vsge",&Jit::Comp_Generic, Dis_VectorSet3, Int_Vsge, IS_VFPU), INSTR("vslt",&Jit::Comp_Generic, Dis_VectorSet3, Int_Vslt, IS_VFPU), };