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

Samuel Pitoiset samuel.pitoiset at gmail.com
Thu Jun 30 22:26:54 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 928923c..f136c58 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -759,6 +759,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.8.3



More information about the mesa-dev mailing list