nv50/ir: optimize SHLADD(a, b, c) to MOV((a << b) + c)
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 14 Sep 2016 20:15:14 +0000 (22:15 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 29 Sep 2016 19:20:47 +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 cbbe34d1e0be11dc1ea50f0c03828fa4f416bce7..9875738593e12b01fcf2b37b1fb2c8bb2b0f17be 100644 (file)
@@ -778,6 +778,9 @@ ConstantFolding::expr(Instruction *i,
       }
       break;
    }
+   case OP_SHLADD:
+      res.data.u32 = (a->data.u32 << b->data.u32) + c->data.u32;
+      break;
    default:
       return;
    }