[Mesa-dev] [PATCH v2 5/8] nv50/ir: optimize ADD3(d, a, b, 0x0) to ADD(d, a, b)

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue Jul 19 10:30:19 UTC 2016


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

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
index 77bac82..ec6418b 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -903,6 +903,14 @@ ConstantFolding::opnd3(Instruction *i, ImmediateValue &imm2)
          return;
       }
       break;
+   case OP_ADD3:
+      if (imm2.isInteger(0)) {
+         i->op = OP_ADD;
+         i->setSrc(2, NULL);
+         foldCount++;
+         break;
+      }
+      break;
    default:
       return;
    }
-- 
2.9.0



More information about the mesa-dev mailing list