#include "codegen/nv50_ir.h"
#include "codegen/nv50_ir_target.h"
-#define __STDC_FORMAT_MACROS
#include <inttypes.h>
namespace nv50_ir {
"mad",
"fma",
"sad",
+ "shladd",
+ "xmad",
"abs",
"neg",
"not",
static const char *pixldOpStr[] =
{
- "count", "covmask", "offset", "cent_offset", "sampleid"
+ "count", "covmask", "covered", "offset", "cent_offset", "sampleid"
};
static const char *rcprsqOpStr[] =
"", "restart"
};
+static const char *cctlOpStr[] =
+{
+ "", "", "", "", "", "iv", "ivall"
+};
+
+static const char *barOpStr[] =
+{
+ "sync", "arrive", "red and", "red or", "red popc"
+};
+
+static const char *xmadOpCModeStr[] =
+{
+ "clo", "chi", "csfu", "cbcc"
+};
+
static const char *DataTypeStr[] =
{
"-",
"TESS_INNER",
"TESS_COORD",
"TID",
+ "COMBINED_TID",
"CTAID",
"NTID",
"GRIDID",
"BASEINSTANCE",
"DRAWID",
"WORK_DIM",
+ "LANEMASK_EQ",
+ "LANEMASK_LT",
+ "LANEMASK_LE",
+ "LANEMASK_GT",
+ "LANEMASK_GE",
"?",
"(INVALID)"
};
"samp sc"
};
+static const char *texMaskStr[16] =
+{
+ "____",
+ "r___",
+ "_g__",
+ "rg__",
+ "__b_",
+ "r_b_",
+ "_gb_",
+ "rgb_",
+ "___a",
+ "r__a",
+ "_g_a",
+ "rg_a",
+ "__ba",
+ "r_ba",
+ "_gba",
+ "rgba",
+};
+
+static const char *gatherCompStr[4] =
+{
+ "r", "g", "b", "a",
+};
+
#define PRINT(args...) \
do { \
pos += snprintf(&buf[pos], size - pos, args); \
if (asFlow()->target.bb)
PRINT(" %sBB:%i", colour[TXT_BRA], asFlow()->target.bb->getId());
} else {
- PRINT("%s ", operationStr[op]);
+ if (asTex())
+ PRINT("%s%s ", operationStr[op], asTex()->tex.scalar ? "s" : "");
+ else
+ PRINT("%s ", operationStr[op]);
if (op == OP_LINTERP || op == OP_PINTERP)
PRINT("%s ", interpStr[ipa]);
switch (op) {
case OP_SUREDP:
+ case OP_SUREDB:
case OP_ATOM:
if (subOp < ARRAY_SIZE(atomSubOpStr))
PRINT("%s ", atomSubOpStr[subOp]);
if (subOp < ARRAY_SIZE(emitOpStr))
PRINT("%s ", emitOpStr[subOp]);
break;
+ case OP_CCTL:
+ if (subOp < ARRAY_SIZE(cctlOpStr))
+ PRINT("%s ", cctlOpStr[subOp]);
+ break;
+ case OP_BAR:
+ if (subOp < ARRAY_SIZE(barOpStr))
+ PRINT("%s ", barOpStr[subOp]);
+ break;
+ case OP_XMAD: {
+ if (subOp & NV50_IR_SUBOP_XMAD_PSL)
+ PRINT("psl ");
+ if (subOp & NV50_IR_SUBOP_XMAD_MRG)
+ PRINT("mrg ");
+ unsigned cmode = (subOp & NV50_IR_SUBOP_XMAD_CMODE_MASK);
+ cmode >>= NV50_IR_SUBOP_XMAD_CMODE_SHIFT;
+ if (cmode && cmode <= ARRAY_SIZE(xmadOpCModeStr))
+ PRINT("%s ", xmadOpCModeStr[cmode - 1]);
+ for (int i = 0; i < 2; i++)
+ PRINT("h%d ", (subOp & NV50_IR_SUBOP_XMAD_H1(i)) ? 1 : 0);
+ break;
+ }
default:
if (subOp)
PRINT("(SUBOP:%u) ", subOp);
}
if (perPatch)
PRINT("patch ");
- if (asTex())
- PRINT("%s %s$r%u $s%u %s", asTex()->tex.target.getName(),
- colour[TXT_MEM], asTex()->tex.r, asTex()->tex.s,
- colour[TXT_INSN]);
+ if (asTex()) {
+ PRINT("%s %s$r%u $s%u ", asTex()->tex.target.getName(),
+ colour[TXT_MEM], asTex()->tex.r, asTex()->tex.s);
+ if (op == OP_TXG)
+ PRINT("%s ", gatherCompStr[asTex()->tex.gatherComp]);
+ PRINT("%s %s", texMaskStr[asTex()->tex.mask], colour[TXT_INSN]);
+ }
+
if (postFactor)
PRINT("x2^%i ", postFactor);
PRINT("%s%s", dnz ? "dnz " : (ftz ? "ftz " : ""), DataTypeStr[dType]);
class PrintPass : public Pass
{
public:
- PrintPass() : serial(0) { }
+ PrintPass(bool omitLineNum) : serial(0), omit_serial(omitLineNum) { }
virtual bool visit(Function *);
virtual bool visit(BasicBlock *);
private:
int serial;
+ bool omit_serial;
};
bool
bool
PrintPass::visit(Instruction *insn)
{
- INFO("%3i: ", serial++);
+ if (omit_serial)
+ INFO(" ");
+ else
+ INFO("%3i: ", serial);
+ serial++;
insn->print();
return true;
}
void
Function::print()
{
- PrintPass pass;
+ PrintPass pass(prog->driver->omitLineNum);
pass.run(this, true, false);
}
void
Program::print()
{
- PrintPass pass;
+ PrintPass pass(driver->omitLineNum);
init_colours();
pass.run(this, true, false);
}