Implement Vscmp

This commit is contained in:
raven02 2012-12-20 21:39:10 +08:00
parent bf0792e42a
commit 936d80b214
3 changed files with 28 additions and 2 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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),
};