[Mesa-dev] [PATCH v3 2/9] gm107/ir: add emission for OP_ADD3

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue Sep 13 19:36:05 UTC 2016


Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 .../drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp
index cfde66c..fd3dd3f 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp
@@ -150,6 +150,7 @@ private:
    void emitLOP();
    void emitNOT();
    void emitIADD();
+   void emitIADD3();
    void emitIMUL();
    void emitIMAD();
    void emitIMNMX();
@@ -1728,6 +1729,36 @@ CodeEmitterGM107::emitIADD()
 }
 
 void
+CodeEmitterGM107::emitIADD3()
+{
+   switch (insn->src(1).getFile()) {
+   case FILE_GPR:
+      emitInsn(0x5cc00000);
+      emitGPR (0x14, insn->src(1));
+      break;
+   case FILE_MEMORY_CONST:
+      emitInsn(0x4cc00000);
+      emitCBUF(0x22, -1, 0x14, 16, 2, insn->src(1));
+      break;
+   case FILE_IMMEDIATE:
+      emitInsn(0x38c00000);
+      emitIMMD(0x14, 19, insn->src(1));
+      break;
+   default:
+      assert(!"bad src1 file");
+      break;
+   }
+   emitNEG(0x33, insn->src(0));
+   emitNEG(0x32, insn->src(1));
+   emitNEG(0x31, insn->src(2));
+   emitX  (0x30);
+   emitCC (0x2f);
+   emitGPR(0x27, insn->src(2));
+   emitGPR(0x08, insn->src(0));
+   emitGPR(0x00, insn->def(0));
+}
+
+void
 CodeEmitterGM107::emitIMUL()
 {
    if (insn->src(1).getFile() != FILE_IMMEDIATE) {
@@ -3077,6 +3108,9 @@ CodeEmitterGM107::emitInstruction(Instruction *i)
          emitIADD();
       }
       break;
+   case OP_ADD3:
+      emitIADD3();
+      break;
    case OP_MUL:
       if (isFloatType(insn->dType)) {
          if (insn->dType == TYPE_F64)
-- 
2.9.3



More information about the mesa-dev mailing list