From e9601584907fe238510f0d13de3ecdc263cd4b8d Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 15 May 2016 14:03:45 -0700 Subject: [PATCH] jit-ir: Add notes and report about vrot prefixes. --- Core/MIPS/IR/IRCompVFPU.cpp | 15 +++++++++++++++ Core/MIPS/MIPSIntVFPU.cpp | 1 + Core/MIPS/x86/CompVFPU.cpp | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/Core/MIPS/IR/IRCompVFPU.cpp b/Core/MIPS/IR/IRCompVFPU.cpp index dab8e97e7a..a4c90ba784 100644 --- a/Core/MIPS/IR/IRCompVFPU.cpp +++ b/Core/MIPS/IR/IRCompVFPU.cpp @@ -1716,6 +1716,17 @@ namespace MIPSComp { // calling the math library. void IRFrontend::Comp_VRot(MIPSOpcode op) { CONDITIONAL_DISABLE; + if (!js.HasNoPrefix()) { + // Prefixes work strangely for this: + // * They never apply to cos (whether d or s prefixes.) + // * They mostly apply to sin/0, e.g. 0:1, M, or |x|. + DISABLE; + } + + // Vector rotation matrix (weird prefixes) + // d[N] = SINCOSVAL(s[0], imm[N]) + // The imm selects: cos index, sin index, 0 or sin for others, sin sign flip. + int vd = _VD; int vs = _VS; int imm = (op >> 16) & 0x1f; @@ -1844,6 +1855,10 @@ namespace MIPSComp { if (js.HasUnknownPrefix()) DISABLE; + // Vector butterfly operation + // vbfy2: d[0] = s[0] + s[2], d[1] = s[1] + s[3], d[2] = s[0] - s[2], d[3] = s[1] - s[3] + // vbfy1: d[N*2] = s[N*2] + s[N*2+1], d[N*2+1] = s[N*2] - s[N*2+1] + VectorSize sz = GetVecSize(op); int n = GetNumVectorElements(sz); if (n != 2 && n != 4) { diff --git a/Core/MIPS/MIPSIntVFPU.cpp b/Core/MIPS/MIPSIntVFPU.cpp index 2d2c8f18f3..784cba75ca 100644 --- a/Core/MIPS/MIPSIntVFPU.cpp +++ b/Core/MIPS/MIPSIntVFPU.cpp @@ -1297,6 +1297,7 @@ namespace MIPSInt // Generates one line of a rotation matrix around one of the three axes void Int_Vrot(MIPSOpcode op) { + // Note: prefixes behave strangely for this. int vd = _VD; int vs = _VS; int imm = (op >> 16) & 0x1f; diff --git a/Core/MIPS/x86/CompVFPU.cpp b/Core/MIPS/x86/CompVFPU.cpp index 50176066f6..33a74ccd01 100644 --- a/Core/MIPS/x86/CompVFPU.cpp +++ b/Core/MIPS/x86/CompVFPU.cpp @@ -3410,6 +3410,14 @@ void Jit::CompVrotShuffle(u8 *dregs, int imm, int n, bool negSin) { // Very heavily used by FF:CC void Jit::Comp_VRot(MIPSOpcode op) { CONDITIONAL_DISABLE; + if (js.HasUnknownPrefix()) { + DISABLE; + } + if (!js.HasNoPrefix()) { + // Prefixes work strangely for this, see IRCompVFPU. + WARN_LOG_REPORT(JIT, "vrot instruction using prefixes at %08x", GetCompilerPC()); + DISABLE; + } int vd = _VD; int vs = _VS;