From 927ce66b391523cc5ac58b36efdac31c4629fb86 Mon Sep 17 00:00:00 2001 From: Ilia Mirkin Date: Sat, 24 Nov 2018 21:56:00 -0500 Subject: [PATCH] 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 Reviewed-by: Karol Herbst --- src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 3 +++ 1 file changed, 3 insertions(+) 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) { -- 2.30.2