The mystery VFPU op turned out to be vmax. Bug in decoding table, sigh.

This commit is contained in:
Henrik Rydgard committed 2012-11-15 13:19:04 +01:00
1 parent a8709b5df1
commit 2bed15f122
4 files changed
+40 -5

No files matched your search

+34
View File
@@ -1240,6 +1240,40 @@ namespace MIPSInt
EatPrefixes();
}
void Int_Vminmax(u32 op) {
int vt = _VT;
int vs = _VS;
int vd = _VD;
int cond = op&15;
VectorSize sz = GetVecSize(op);
int n = GetNumVectorElements(sz);
float s[4];
float t[4];
float d[4];
ReadVector(s, sz, vs);
ApplySwizzleS(s, sz);
ReadVector(t, sz, vt);
ApplySwizzleT(t, sz);
// positive NAN always loses, unlike SSE
// negative NAN seems different? TODO
switch ((op >> 23) & 3) {
case 2: // vmin
for (int i = 0; i < GetNumVectorElements(sz); i++)
d[i] = isnan(t[i]) ? s[i] : (isnan(s[i]) ? t[i] : std::min(s[i], t[i]));
break;
case 3: // vmax
for (int i = 0; i < GetNumVectorElements(sz); i++)
d[i] = isnan(t[i]) ? s[i] : (isnan(s[i]) ? t[i] : std::max(s[i], t[i]));
break;
default:
_dbg_assert_msg_(CPU,0,"unknown min/max op %d", cond);
return;
}
ApplyPrefixD(d, sz);
WriteVector(d, sz, vd);
PC += 4;
EatPrefixes();
}
void Int_Vcmov(u32 op)
{
+1
View File
@@ -48,6 +48,7 @@ namespace MIPSInt
void Int_VScl(u32 op);
void Int_Vidt(u32 op);
void Int_Vcmp(u32 op);
void Int_Vminmax(u32 op);
void Int_Vcrs(u32 op);
void Int_Vcmov(u32 op);
void Int_CrossQuat(u32 op);
+4 -4
View File
@@ -505,9 +505,9 @@ MIPSInstruction tableVFPU1[8] =
MIPSInstruction tableVFPU3[8] = //011011 xxx
{
INSTR("vcmp",&Jit::Comp_Generic, Dis_Vcmp, Int_Vcmp, IS_VFPU),
INSTR("v???",&Jit::Comp_Generic, Dis_Generic, Int_Vcmp, IS_VFPU), // 0x6de84848 in motogp
INSTR("vmin",&Jit::Comp_Generic, Dis_Generic, 0, IS_VFPU),
INSTR("vmax",&Jit::Comp_Generic, Dis_Generic, 0, IS_VFPU),
{-2},
INSTR("vmin",&Jit::Comp_Generic, Dis_Generic, Int_Vminmax, IS_VFPU),
INSTR("vmax",&Jit::Comp_Generic, Dis_Generic, Int_Vminmax, IS_VFPU),
{-2},
INSTR("vscmp",&Jit::Comp_Generic, Dis_Generic, 0, IS_VFPU),
INSTR("vsge",&Jit::Comp_Generic, Dis_Generic, 0, IS_VFPU),
@@ -782,7 +782,7 @@ const int encodingBits[NumEncodings][2] =
{0, 0}, //Cop2Rese
{23, 3}, //VFPU0
{23, 3}, //VFPU1
{23, 1}, //VFPU3
{23, 3}, //VFPU3
{21, 5}, //VFPU4Jump
{16, 5}, //VFPU7
{16, 5}, //VFPU4