diff options
author | Ilia Mirkin <[email protected]> | 2014-09-01 10:55:27 -0400 |
---|---|---|
committer | Ilia Mirkin <[email protected]> | 2014-09-01 18:38:02 -0400 |
commit | 6c2b079231f84b09b3f35183930afe522baee168 (patch) | |
tree | fbcf5590cda2f721f096698f2f13607aa2ad7f69 | |
parent | 115d9a5525e74573ced9209063a1d4a551e6eaa4 (diff) |
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 <[email protected]>
Signed-off-by: Ilia Mirkin <[email protected]>
Cc: "10.2 10.3" <[email protected]>
-rw-r--r-- | src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 4 |
1 files changed, 4 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 1a9a25fa7ec..719f9805af8 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() */ } |