nv50/ir: fix ConstantFolding::createMul for 64 bit muls
authorKarol Herbst <kherbst@redhat.com>
Fri, 19 Oct 2018 17:26:39 +0000 (19:26 +0200)
committerKarol Herbst <kherbst@redhat.com>
Sat, 20 Oct 2018 01:00:04 +0000 (03:00 +0200)
Fixes: 2f52925f5c60c72c9389bfdc122c3d5f8e15b25f
       "nv50/ir: move a * b -> a << log2(b) code into createMul()"

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Signed-off-by: Karol Herbst <kherbst@redhat.com>
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp

index d851cf3c37cdc9fab83af6ec9b5dbfa70536bcc6..8767e5efb99aab198fa784c3712054c33bcc4a5b 100644 (file)
@@ -965,7 +965,7 @@ ConstantFolding::createMul(DataType ty, Value *def, Value *a, int64_t b, Value *
    if (b >= 0 && util_is_power_of_two_or_zero64(b)) {
       int shl = util_logbase2_64(b);
 
-      Value *res = c ? bld.getSSA() : def;
+      Value *res = c ? bld.getSSA(typeSizeof(ty)) : def;
       bld.mkOp2(OP_SHL, ty, res, a, bld.mkImm(shl));
       if (c)
          bld.mkOp2(OP_ADD, ty, def, res, c);