nv50/ir: add CCTL (cache control) op
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Mon, 11 Mar 2013 16:34:05 +0000 (17:34 +0100)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Tue, 12 Mar 2013 11:55:37 +0000 (12:55 +0100)
src/gallium/drivers/nv50/codegen/nv50_ir.h
src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp
src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp
src/gallium/drivers/nv50/codegen/nv50_ir_target.cpp
src/gallium/drivers/nvc0/codegen/nv50_ir_emit_nvc0.cpp

index 7862724..236673c 100644 (file)
@@ -153,6 +153,7 @@ enum operation
    OP_VSHR,
    OP_VSHL,
    OP_VSEL,
+   OP_CCTL, // cache control
    OP_LAST
 };
 
@@ -199,6 +200,8 @@ enum operation
 #define NV50_IR_SUBOP_ATOM_XOR      7
 #define NV50_IR_SUBOP_ATOM_CAS      8
 #define NV50_IR_SUBOP_ATOM_EXCH     9
+#define NV50_IR_SUBOP_CCTL_IV      5
+#define NV50_IR_SUBOP_CCTL_IVALL   6
 #define NV50_IR_SUBOP_SUST_IGN     0
 #define NV50_IR_SUBOP_SUST_TRAP    1
 #define NV50_IR_SUBOP_SUST_SDCL    3
index 2926907..aee3d55 100644 (file)
@@ -1791,7 +1791,7 @@ MemoryOpt::runOpt(BasicBlock *bb)
             purgeRecords(NULL, FILE_MEMORY_SHARED);
             purgeRecords(NULL, FILE_SHADER_OUTPUT);
          } else
-         if (ldst->op == OP_ATOM) {
+         if (ldst->op == OP_ATOM || ldst->op == OP_CCTL) {
             if (ldst->src(0).getFile() == FILE_MEMORY_GLOBAL) {
                purgeRecords(NULL, FILE_MEMORY_LOCAL);
                purgeRecords(NULL, FILE_MEMORY_GLOBAL);
index 1c3b768..c7121bf 100644 (file)
@@ -183,6 +183,7 @@ const char *operationStr[OP_LAST + 1] =
    "vshr",
    "vshl",
    "vsel",
+   "cctl",
    "(invalid)"
 };
 
index 1b6d183..63da152 100644 (file)
@@ -53,7 +53,7 @@ const uint8_t Target::operationSrcNr[OP_LAST + 1] =
    2, 3, 2, 3,             // POPCNT, INSBF, EXTBF, PERMT
    2, 2,                   // ATOM, BAR
    2, 2, 2, 2, 3, 2,       // VADD, VAVG, VMIN, VMAX, VSAD, VSET,
-   2, 2, 2,                // VSHR, VSHL, VSEL
+   2, 2, 2, 1,             // VSHR, VSHL, VSEL, CCTL
    0
 };
 
@@ -123,8 +123,8 @@ const OpClass Target::operationClass[OP_LAST + 1] =
    OPCLASS_VECTOR, OPCLASS_VECTOR, OPCLASS_VECTOR, OPCLASS_VECTOR,
    // VSAD, VSET, VSHR, VSHL
    OPCLASS_VECTOR, OPCLASS_VECTOR, OPCLASS_VECTOR, OPCLASS_VECTOR,
-   // VSEL
-   OPCLASS_VECTOR,
+   // VSEL, CCTL
+   OPCLASS_VECTOR, OPCLASS_CONTROL,
    OPCLASS_PSEUDO // LAST
 };
 
index 64207d7..ba2f73b 100644 (file)
@@ -82,6 +82,7 @@ private:
    void emitMOV(const Instruction *);
    void emitATOM(const Instruction *);
    void emitMEMBAR(const Instruction *);
+   void emitCCTL(const Instruction *);
 
    void emitINTERP(const Instruction *);
    void emitPFETCH(const Instruction *);
@@ -1886,6 +1887,27 @@ CodeEmitterNVC0::emitMEMBAR(const Instruction *i)
 }
 
 void
+CodeEmitterNVC0::emitCCTL(const Instruction *i)
+{
+   code[0] = 0x00000005 | (i->subOp << 5);
+
+   if (i->src(0).getFile() == FILE_MEMORY_GLOBAL) {
+      code[1] = 0x98000000;
+      srcAddr32(i->src(0), 28, 2);
+   } else {
+      code[1] = 0xd0000000;
+      setAddress24(i->src(0));
+   }
+   if (uses64bitAddress(i))
+      code[1] |= 1 << 26;
+   srcId(i->src(0).getIndirect(0), 20);
+
+   emitPredicate(i);
+
+   defId(i, 0, 14);
+}
+
+void
 CodeEmitterNVC0::emitSUCLAMPMode(uint16_t subOp)
 {
    uint8_t m;
@@ -2348,6 +2370,9 @@ CodeEmitterNVC0::emitInstruction(Instruction *insn)
    case OP_MEMBAR:
       emitMEMBAR(insn);
       break;
+   case OP_CCTL:
+      emitCCTL(insn);
+      break;
    case OP_VSHL:
       emitVSHL(insn);
       break;