[Mesa-dev] [PATCH v2 4/8] nv50/ir: optimize ADD3(d, a, b, c) to MOV(d, a + b + c)

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue Jul 19 10:30:18 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 ceb9718..77bac82 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -763,6 +763,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.0



More information about the mesa-dev mailing list