From 7c9f368d6307da66d428a940ee193a5b4eb08e9b Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 14 May 2016 14:21:53 -0700 Subject: [PATCH] jit-ir: Add some descriptions of mnemonics. Sometimes I forget what vhdp etc. meant, let's make the VFPU code a bit more accessible. --- Core/MIPS/IR/IRCompVFPU.cpp | 51 +++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/Core/MIPS/IR/IRCompVFPU.cpp b/Core/MIPS/IR/IRCompVFPU.cpp index 1b484fbb60..a469a9cf81 100644 --- a/Core/MIPS/IR/IRCompVFPU.cpp +++ b/Core/MIPS/IR/IRCompVFPU.cpp @@ -315,6 +315,9 @@ namespace MIPSComp { DISABLE; } + // Vector init + // d[N] = CONST[N] + VectorSize sz = GetVecSize(op); int type = (op >> 16) & 0xF; int vd = _VD; @@ -338,6 +341,9 @@ namespace MIPSComp { DISABLE; } + // Vector identity row + // d[N] = IDENTITY[N,m] + int vd = _VD; VectorSize sz = GetVecSize(op); u8 dregs[4]; @@ -374,6 +380,9 @@ namespace MIPSComp { DISABLE; } + // Matrix init + // d[N,M] = CONST[N,M] + // Not really about trying here, it will work if enabled. VectorSize vsz = GetVectorSize(sz); u8 vecs[4]; @@ -412,6 +421,10 @@ namespace MIPSComp { DISABLE; } + // Vector homogenous dot product + // d[0] = s[0 .. n-2] dot t[0 .. n-2] + t[n-1] + // Note: s[n-1] is ignored. + int vd = _VD; int vs = _VS; int vt = _VT; @@ -448,6 +461,11 @@ namespace MIPSComp { if (js.HasUnknownPrefix()) DISABLE; + // Vector horizontal add + // d[0] = s[0] + ... s[n-1] + // Vector horizontal average + // d[0] = (s[0] + ... s[n-1]) / n + VectorSize sz = GetVecSize(op); int n = GetNumVectorElements(sz); @@ -480,6 +498,9 @@ namespace MIPSComp { DISABLE; } + // Vector dot product + // d[0] = s[0 .. n-1] dot t[0 .. n-1] + int vd = _VD; int vs = _VS; int vt = _VT; @@ -514,6 +535,9 @@ namespace MIPSComp { if (js.HasUnknownPrefix()) DISABLE; + // Vector arithmetic + // d[N] = OP(s[N], t[N]) (see below) + // Check that we can support the ops, and prepare temporary values for ops that need it. bool allowSIMD = true; switch (op >> 26) { @@ -672,6 +696,9 @@ namespace MIPSComp { if (js.HasUnknownPrefix()) DISABLE; + // Vector unary operation + // d[N] = OP(s[N]) (see below) + int vs = _VS; int vd = _VD; @@ -787,6 +814,9 @@ namespace MIPSComp { DISABLE; } + // Vector integer to float + // d[N] = float(S[N]) * mult + VectorSize sz = GetVecSize(op); int n = GetNumVectorElements(sz); @@ -878,11 +908,12 @@ namespace MIPSComp { EatPrefix(); } - // Good above - void IRFrontend::Comp_Vmfvc(MIPSOpcode op) { CONDITIONAL_DISABLE; + // Vector Move from vector control reg + // S[0] = VFPU_CTRL[i] + int vs = _VS; int imm = op & 0xFF; if (imm >= 128 && imm < 128 + VFPU_CTRL_MAX) { @@ -892,11 +923,17 @@ namespace MIPSComp { // } else { ir.Write(IROp::VfpuCtrlToReg, IRTEMP_0, imm - 128); ir.Write(IROp::FMovFromGPR, vfpuBase + voffset[vs], IRTEMP_0); + } else { + DISABLE; } } void IRFrontend::Comp_Vmtvc(MIPSOpcode op) { CONDITIONAL_DISABLE; + + // Vector Move from vector control reg + // VFPU_CTRL[i] = S[0] + int vs = _VS; int imm = op & 0xFF; if (imm >= 128 && imm < 128 + VFPU_CTRL_MAX) { @@ -914,6 +951,9 @@ namespace MIPSComp { void IRFrontend::Comp_Vmmov(MIPSOpcode op) { CONDITIONAL_DISABLE; + // Matrix move + // D[N,M] = S[N,M] + int vs = _VS; int vd = _VD; // This probably ignores prefixes for all sane intents and purposes. @@ -980,6 +1020,9 @@ namespace MIPSComp { DISABLE; } + // Vector scale, vector by scalar + // d[N] = s[N] * t[0] + VectorSize sz = GetVecSize(op); int n = GetNumVectorElements(sz); @@ -1134,6 +1177,10 @@ namespace MIPSComp { DISABLE; } + // Vertex transform, vector by matrix + // d[N] = s[N*m .. N*m + n-1] dot t[0 .. n-1] + // Homogenous means t[n-1] is treated as 1. + VectorSize sz = GetVecSize(op); MatrixSize msz = GetMtxSize(op); int n = GetNumVectorElements(sz);