[Mesa-dev] [PATCH 1/2] nv50/ir: don't optimize dnz muls to add
Karol Herbst
kherbst at redhat.com
Sat Nov 24 23:04:20 UTC 2018
fixes asserts with gallium nine
Signed-off-by: Karol Herbst <kherbst at redhat.com>
---
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 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..0a284572ede 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -557,6 +557,8 @@ ConstantFolding::expr(Instruction *i,
case OP_MAD:
case OP_FMA:
case OP_MUL:
+ if (i->dnz && i->op != OP_MUL)
+ return;
if (i->dnz && i->dType == TYPE_F32) {
if (!isfinite(a->data.f32))
a->data.f32 = 0.0f;
@@ -1089,7 +1091,7 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s)
i->src(0).mod = 0;
i->setSrc(1, NULL);
} else
- if (!i->postFactor && (imm0.isInteger(2) || imm0.isInteger(-2))) {
+ if (!i->postFactor && !i->dnz && (imm0.isInteger(2) || imm0.isInteger(-2))) {
if (imm0.isNegative())
i->src(t).mod = i->src(t).mod ^ Modifier(NV50_IR_MOD_NEG);
i->op = OP_ADD;
@@ -1120,7 +1122,7 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s)
if (i->op != OP_CVT)
i->src(0).mod = 0;
} else
- if (i->subOp != NV50_IR_SUBOP_MUL_HIGH &&
+ if (i->subOp != NV50_IR_SUBOP_MUL_HIGH && !i->dnz &&
(imm0.isInteger(1) || imm0.isInteger(-1))) {
if (imm0.isNegative())
i->src(t).mod = i->src(t).mod ^ Modifier(NV50_IR_MOD_NEG);
--
2.19.1
More information about the mesa-dev
mailing list