summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Mirkin <imirkin@alum.mit.edu>2018-11-24 21:56:00 -0500
committerIlia Mirkin <imirkin@alum.mit.edu>2018-11-24 22:15:53 -0500
commit927ce66b391523cc5ac58b36efdac31c4629fb86 (patch)
tree94d117d415d9c82719bcf8b90a087b6bbcf1d197
parentd4e7d8b7f053db081a4ffdb59dc53f3531b0e60b (diff)
nv50/ir: remove dnz flag when converting MAD to ADD due to optimizations
dnz flag only applies for multiplications (e.g. to make 0 * Infinity becomes 0 instead of NaN). Once we optimize a MAD into an ADD, the dnz flag no longer makes sense, and upsets the GM107 emitter (since it looks at the ftz and dnz flags together). Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Karol Herbst <kherbst@redhat.com>
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
index 04d26dcbf53..202faf0746a 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -740,6 +740,7 @@ ConstantFolding::expr(Instruction *i,
// restrictions, so move it into a separate LValue.
bld.setPosition(i, false);
i->op = OP_ADD;
+ i->dnz = 0;
i->setSrc(1, bld.mkMov(bld.getSSA(type), i->getSrc(0), type)->getDef(0));
i->setSrc(0, i->getSrc(2));
i->src(0).mod = i->src(2).mod;
@@ -1093,6 +1094,7 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s)
if (imm0.isNegative())
i->src(t).mod = i->src(t).mod ^ Modifier(NV50_IR_MOD_NEG);
i->op = OP_ADD;
+ i->dnz = 0;
i->setSrc(s, i->getSrc(t));
i->src(s).mod = i->src(t).mod;
} else
@@ -1131,6 +1133,7 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s)
i->setSrc(1, i->getSrc(2));
i->src(1).mod = i->src(2).mod;
i->setSrc(2, NULL);
+ i->dnz = 0;
i->op = OP_ADD;
} else
if (!isFloatType(i->dType) && !i->subOp && !i->src(t).mod && !i->src(2).mod) {