nvc0/ir: fold postfactor into immediate
authorIlia Mirkin <imirkin@alum.mit.edu>
Wed, 2 Dec 2015 01:35:19 +0000 (20:35 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Wed, 2 Dec 2015 23:51:15 +0000 (18:51 -0500)
SM20-SM50 can't emit a post-factor in the presence of a long immediate.
Make sure to fold it in.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp

index 0f1dcf0dacd3faa536a91c248b1df0c8316b20a4..9c42e4a7e017c398c24fad7a546ee9078ceea8a9 100644 (file)
@@ -858,6 +858,12 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s)
          i->src(0).mod = i->src(t).mod;
          i->setSrc(1, new_ImmediateValue(prog, imm0.reg.data.u32));
          i->src(1).mod = 0;
+      } else
+      if (i->postFactor && i->sType == TYPE_F32) {
+         /* Can't emit a postfactor with an immediate, have to fold it in */
+         i->setSrc(s, new_ImmediateValue(
+                      prog, imm0.reg.data.f32 * exp2f(i->postFactor)));
+         i->postFactor = 0;
       }
       break;
    case OP_MAD: