[Mesa-dev] [PATCH v3 5/9] nv50/ir: optimize ADD3(d, a, b, c) to MOV(d, a + b + c)

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


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

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
index fe815e3..ecde364 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -797,6 +797,17 @@ ConstantFolding::expr(Instruction *i,
       }
       break;
    }
+   case OP_ADD3: {
+      switch (i->dType) {
+      case TYPE_S32:
+      case TYPE_U32:
+         res.data.u32 = a->data.u32 + b->data.u32 + c->data.u32;
+         break;
+      default:
+         return;
+      }
+      break;
+   }
    default:
       return;
    }
-- 
2.9.3



More information about the mesa-dev mailing list