[Nouveau] [PATCH 2/3] nv50/ir: For MAD, prefer SDST == SSRC2

Roy Spliet rspliet at eclipso.eu
Sat Jan 10 16:22:59 PST 2015


If liveness analysis indicates it's good, this should improve the chances
of being able to emit the short MAD form.

Signed-off-by: Roy Spliet <rspliet at eclipso.eu>
---
 src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
index 898653c..1273449 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
@@ -627,6 +627,7 @@ RegAlloc::BuildIntervalsPass::visit(BasicBlock *bb)
 #define JOIN_MASK_UNION      (1 << 1)
 #define JOIN_MASK_MOV        (1 << 2)
 #define JOIN_MASK_TEX        (1 << 3)
+#define JOIN_MASK_MAD        (1 << 4)
 
 class GCRA
 {
@@ -851,7 +852,7 @@ GCRA::coalesce(ArrayList& insns)
    case 0x80:
    case 0x90:
    case 0xa0:
-      ret = doCoalesce(insns, JOIN_MASK_UNION | JOIN_MASK_TEX);
+      ret = doCoalesce(insns, JOIN_MASK_UNION | JOIN_MASK_TEX | JOIN_MASK_MAD);
       break;
    case 0xc0:
    case 0xd0:
@@ -995,6 +996,13 @@ GCRA::doCoalesce(ArrayList& insns, unsigned int mask)
                copyCompound(insn->getSrc(0), insn->getDef(0));
          }
          break;
+      case OP_MAD:
+         if (!(mask & JOIN_MASK_MAD))
+            break;
+         if (insn->srcExists(2) && insn->src(2).getFile() == FILE_GPR &&
+             insn->def(0).getFile() == FILE_GPR)
+            coalesceValues(insn->getDef(0), insn->getSrc(2), false);
+         break;
       case OP_TEX:
       case OP_TXB:
       case OP_TXL:
-- 
2.1.0





More information about the Nouveau mailing list