Mesa (10.2): nv50/ir: avoid creating instructions that can't be emitted

Emil Velikov evelikov at kemper.freedesktop.org
Tue Sep 2 19:53:33 UTC 2014


Module: Mesa
Branch: 10.2
Commit: a70892679293b3056475beaee4681294966d1698
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a70892679293b3056475beaee4681294966d1698

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Mon Sep  1 10:55:27 2014 -0400

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>
(cherry picked from commit 6c2b079231f84b09b3f35183930afe522baee168)

---

 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 6e5b66c..d51306e 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -560,6 +560,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() */
    }




More information about the mesa-commit mailing list