Mesa (master): nv50/ir: propagate modifier to right arg when const-folding mad

Ilia Mirkin imirkin at kemper.freedesktop.org
Fri Jun 26 22:43:22 UTC 2015


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

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Fri Jun 26 15:01:22 2015 -0400

nv50/ir: propagate modifier to right arg when const-folding mad

An immediate has to be the second arg of an ADD operation. However we
were mistakenly propagating the modifier of the non-folded value to the
folded immediate argument.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91117
Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Cc: "10.5 10.6" <mesa-stable at lists.freedesktop.org>

---

 src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
index ae739ee..ad9bf6f 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -608,9 +608,12 @@ ConstantFolding::expr(Instruction *i,
    case OP_FMA: {
       i->op = OP_ADD;
 
+      /* Move the immediate to the second arg, otherwise the ADD operation
+       * won't be emittable
+       */
       i->setSrc(1, i->getSrc(0));
-      i->src(1).mod = i->src(2).mod;
       i->setSrc(0, i->getSrc(2));
+      i->src(0).mod = i->src(2).mod;
       i->setSrc(2, NULL);
 
       ImmediateValue src0;




More information about the mesa-commit mailing list