diff --git a/Core/MIPS/MIPSIntVFPU.cpp b/Core/MIPS/MIPSIntVFPU.cpp index 89ca31ca4c..7edc289095 100644 --- a/Core/MIPS/MIPSIntVFPU.cpp +++ b/Core/MIPS/MIPSIntVFPU.cpp @@ -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) { diff --git a/Core/MIPS/MIPSIntVFPU.h b/Core/MIPS/MIPSIntVFPU.h index 2d4d286efa..d246c43a44 100644 --- a/Core/MIPS/MIPSIntVFPU.h +++ b/Core/MIPS/MIPSIntVFPU.h @@ -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); diff --git a/Core/MIPS/MIPSTables.cpp b/Core/MIPS/MIPSTables.cpp index 2d68b3e8c7..fc662f9c86 100644 --- a/Core/MIPS/MIPSTables.cpp +++ b/Core/MIPS/MIPSTables.cpp @@ -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 diff --git a/pspautotests b/pspautotests index cb8c23e174..87354c1b26 160000 --- a/pspautotests +++ b/pspautotests @@ -1 +1 @@ -Subproject commit cb8c23e1748d9e98ebb21797d8449d8711f04439 +Subproject commit 87354c1b266645318236914a7c2a5771d6c115b2