From b7ef3ad9e98f1acfad9b9de46e5b284796fba218 Mon Sep 17 00:00:00 2001 From: raven02 Date: Fri, 21 Dec 2012 11:05:53 +0800 Subject: [PATCH 1/2] Implement Vsocp --- Core/MIPS/MIPSIntVFPU.cpp | 23 +++++++++++++++++++++++ Core/MIPS/MIPSIntVFPU.h | 1 + Core/MIPS/MIPSTables.cpp | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Core/MIPS/MIPSIntVFPU.cpp b/Core/MIPS/MIPSIntVFPU.cpp index b3045b9a4b..4b25af5631 100644 --- a/Core/MIPS/MIPSIntVFPU.cpp +++ b/Core/MIPS/MIPSIntVFPU.cpp @@ -506,6 +506,29 @@ namespace MIPSInt PC += 4; EatPrefixes(); } + + void Int_Vsocp(u32 op) + { + float s[4], d[4]; + int vd = _VD; + int vs = _VS; + VectorSize sz = GetVecSize(op); + ReadVector(s, sz, vs); + ApplySwizzleS(s, sz); + int n=GetNumVectorElements(sz); + float x = s[0]; + d[0] = std::min(std::max(0.0f, 1.0f - x), 1.0f); + d[1] = std::min(std::max(0.0f, x), 1.0f); + if (n > 1) { + float y = s[1]; + d[2] = std::min(std::max(0.0f, 1.0f - y), 1.0f); + d[3] = std::min(std::max(0.0f, y), 1.0f); + } + ApplyPrefixD(d, sz); + WriteVector(d, sz, vd); + PC += 4; + EatPrefixes(); + } void Int_Vsgn(u32 op) { diff --git a/Core/MIPS/MIPSIntVFPU.h b/Core/MIPS/MIPSIntVFPU.h index 50e7229366..ebcd1c4362 100644 --- a/Core/MIPS/MIPSIntVFPU.h +++ b/Core/MIPS/MIPSIntVFPU.h @@ -42,6 +42,7 @@ namespace MIPSInt void Int_Vavg(u32 op); void Int_Vfad(u32 op); void Int_Vocp(u32 op); + void Int_Vsocp(u32 op); void Int_Vsgn(u32 op); void Int_Vtfm(u32 op); void Int_Viim(u32 op); diff --git a/Core/MIPS/MIPSTables.cpp b/Core/MIPS/MIPSTables.cpp index 67d9b70e92..93b636f873 100644 --- a/Core/MIPS/MIPSTables.cpp +++ b/Core/MIPS/MIPSTables.cpp @@ -691,7 +691,7 @@ MIPSInstruction tableVFPU9[32] = //110100 00010 xxxxx INSTR("vbfy2", &Jit::Comp_Generic, Dis_Vbfy, Int_Vbfy, IS_VFPU), //4 INSTR("vocp", &Jit::Comp_Generic, Dis_Vbfy, Int_Vocp, IS_VFPU), // one's complement - INSTR("vsocp", &Jit::Comp_Generic, Dis_Generic, 0, IS_VFPU), + INSTR("vsocp", &Jit::Comp_Generic, Dis_Vbfy, Int_Vsocp, IS_VFPU), INSTR("vfad", &Jit::Comp_Generic, Dis_Vfad, Int_Vfad, IS_VFPU), INSTR("vavg", &Jit::Comp_Generic, Dis_Vfad, Int_Vavg, IS_VFPU), //8 From fb773b5acf0ab044864b4adc49848df0a62e58cf Mon Sep 17 00:00:00 2001 From: raven02 Date: Fri, 21 Dec 2012 17:30:17 +0800 Subject: [PATCH 2/2] Fix tab issue --- Core/MIPS/MIPSIntVFPU.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Core/MIPS/MIPSIntVFPU.cpp b/Core/MIPS/MIPSIntVFPU.cpp index 4b25af5631..d80ca2764d 100644 --- a/Core/MIPS/MIPSIntVFPU.cpp +++ b/Core/MIPS/MIPSIntVFPU.cpp @@ -517,13 +517,13 @@ namespace MIPSInt ApplySwizzleS(s, sz); int n=GetNumVectorElements(sz); float x = s[0]; - d[0] = std::min(std::max(0.0f, 1.0f - x), 1.0f); - d[1] = std::min(std::max(0.0f, x), 1.0f); - if (n > 1) { - float y = s[1]; - d[2] = std::min(std::max(0.0f, 1.0f - y), 1.0f); - d[3] = std::min(std::max(0.0f, y), 1.0f); - } + d[0] = std::min(std::max(0.0f, 1.0f - x), 1.0f); + d[1] = std::min(std::max(0.0f, x), 1.0f); + if (n > 1) { + float y = s[1]; + d[2] = std::min(std::max(0.0f, 1.0f - y), 1.0f); + d[3] = std::min(std::max(0.0f, y), 1.0f); + } ApplyPrefixD(d, sz); WriteVector(d, sz, vd); PC += 4;