Ilia Mirkin
2014-Sep-01 15:09 UTC
[Nouveau] [PATCH] nv50/ir: avoid creating instructions that can't be emitted
When constant folding a MAD operation, we first fold the multiply and generate an ADD. However we do so without making sure that the immediate can be handled in the saturate case. If it can't, load the immediate in a separate instruction. Reported-by: Tiziano Bacocco <tizbac2 at gmail.com> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu> Cc: "10.2 10.3" <mesa-stable at lists.freedesktop.org> --- src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp index 1a9a25f..719f980 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp @@ -567,6 +567,10 @@ ConstantFolding::expr(Instruction *i, ImmediateValue src0; if (i->src(0).getImmediate(src0)) expr(i, src0, *i->getSrc(1)->asImm()); + if (i->saturate && !prog->getTarget()->isSatSupported(i)) { + bld.setPosition(i, false); + i->setSrc(1, bld.loadImm(NULL, res.data.u32)); + } } else { i->op = i->saturate ? OP_SAT : OP_MOV; /* SAT handled by unary() */ } -- 1.8.5.5
Reasonably Related Threads
- [PATCH v2 1/3] nv50/ir: fix AlgebraicOpt for slcts with mods
- [PATCH] nv50/ir: Propagate third immediate src when folding OP_MAD
- [PATCH 1/4] nvc0/ir: clear subop when folding constant expressions
- [PATCH v2 1/4] nvc0/ir: clear subop when folding constant expressions
- [PATCH v3 1/4] nvc0/ir: clear subop when folding constant expressions