Mesa (master): nv50/ir/opt: swap VP inputs to first source where possible

Christoph Bumiller chrisbmr at kemper.freedesktop.org
Thu Apr 19 12:58:52 UTC 2012


Module: Mesa
Branch: master
Commit: 90b5301ceab8fd86fccf76efe7ebb039c0e4a28f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=90b5301ceab8fd86fccf76efe7ebb039c0e4a28f

Author: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
Date:   Wed Apr 18 17:00:52 2012 +0200

nv50/ir/opt: swap VP inputs to first source where possible

---

 .../drivers/nv50/codegen/nv50_ir_peephole.cpp      |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp
index 3852a8d..7d0ebc6 100644
--- a/src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp
@@ -123,6 +123,7 @@ private:
 
    bool isCSpaceLoad(Instruction *);
    bool isImmd32Load(Instruction *);
+   bool isAttribOrSharedLoad(Instruction *);
 };
 
 bool
@@ -139,6 +140,16 @@ LoadPropagation::isImmd32Load(Instruction *ld)
    return ld->src(0).getFile() == FILE_IMMEDIATE;
 }
 
+bool
+LoadPropagation::isAttribOrSharedLoad(Instruction *ld)
+{
+   return ld &&
+      (ld->op == OP_VFETCH ||
+       (ld->op == OP_LOAD &&
+        (ld->src(0).getFile() == FILE_SHADER_INPUT ||
+         ld->src(0).getFile() == FILE_MEMORY_SHARED)));
+}
+
 void
 LoadPropagation::checkSwapSrc01(Instruction *insn)
 {
@@ -162,6 +173,12 @@ LoadPropagation::checkSwapSrc01(Instruction *insn)
          insn->swapSources(0, 1);
       else
          return;
+   } else
+   if (isAttribOrSharedLoad(i1)) {
+      if (!isAttribOrSharedLoad(i0))
+         insn->swapSources(0, 1);
+      else
+         return;
    } else {
       return;
    }




More information about the mesa-commit mailing list