From 9d1d4473e8ab12a52f1982bb43676bc5de3a1b8a Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 24 Feb 2019 15:40:58 -0800 Subject: [PATCH] interp: Confirm vi2f/vf2i prefix handling. --- Core/MIPS/MIPSIntVFPU.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Core/MIPS/MIPSIntVFPU.cpp b/Core/MIPS/MIPSIntVFPU.cpp index 8f9403b7ce..717367d1b2 100644 --- a/Core/MIPS/MIPSIntVFPU.cpp +++ b/Core/MIPS/MIPSIntVFPU.cpp @@ -642,7 +642,8 @@ namespace MIPSInt float mult = (float)(1UL << imm); VectorSize sz = GetVecSize(op); ReadVector(s, sz, vs); - ApplySwizzleS(s, sz); //TODO: and the mask to kill everything but swizzle + // Negate, abs, and constants apply as you'd expect to the bits. + ApplySwizzleS(s, sz); for (int i = 0; i < GetNumVectorElements(sz); i++) { if (my_isnan(s[i])) { d[i] = 0x7FFFFFFF; @@ -665,14 +666,14 @@ namespace MIPSInt } } } + // Does not apply sat, but does apply mask. ApplyPrefixD(reinterpret_cast(d), sz, true); WriteVector(reinterpret_cast(d), sz, vd); PC += 4; EatPrefixes(); } - void Int_Vi2f(MIPSOpcode op) - { + void Int_Vi2f(MIPSOpcode op) { int s[4]; float d[4]; int vd = _VD; @@ -681,12 +682,13 @@ namespace MIPSInt float mult = 1.0f/(float)(1UL << imm); VectorSize sz = GetVecSize(op); ReadVector(reinterpret_cast(s), sz, vs); - ApplySwizzleS(reinterpret_cast(s), sz); //TODO: and the mask to kill everything but swizzle - for (int i = 0; i < GetNumVectorElements(sz); i++) - { + // Negate, abs, and constants apply as you'd expect to the bits. + ApplySwizzleS(reinterpret_cast(s), sz); + for (int i = 0; i < GetNumVectorElements(sz); i++) { d[i] = (float)s[i] * mult; } - ApplyPrefixD(d, sz); //TODO: and the mask to kill everything but mask + // Sat and mask apply normally. + ApplyPrefixD(d, sz); WriteVector(d, sz, vd); PC += 4; EatPrefixes();