nv50/ir: optimize SHLADD(a, b, 0x0) to SHL(a, b)
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 14 Sep 2016 16:57:02 +0000 (18:57 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 29 Sep 2016 19:20:44 +0000 (21:20 +0200)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp

index c9d5b5f7d653aa9c85459c0f259691a11dcaf0d4..cbbe34d1e0be11dc1ea50f0c03828fa4f416bce7 100644 (file)
@@ -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;
    }