Mesa (master): nv50/ir: optimize SHLADD(a, b, 0x0) to SHL(a, b)

Samuel Pitoiset hakzsam at kemper.freedesktop.org
Thu Sep 29 19:22:00 UTC 2016


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

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Wed Sep 14 18:57:02 2016 +0200

nv50/ir: optimize SHLADD(a, b, 0x0) to SHL(a, b)

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

---

 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 c9d5b5f..cbbe34d 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -907,6 +907,14 @@ ConstantFolding::opnd3(Instruction *i, ImmediateValue &imm2)
          return;
       }
       break;
+   case OP_SHLADD:
+      if (imm2.isInteger(0)) {
+         i->op = OP_SHL;
+         i->setSrc(2, NULL);
+         foldCount++;
+         return;
+      }
+      break;
    default:
       return;
    }




More information about the mesa-commit mailing list