Mesa (master): nv50/ir/opt: don't lose saturation in tryCollapseChainedMULs

Christoph Bumiller chrisbmr at kemper.freedesktop.org
Sun May 6 20:04:17 UTC 2012


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

Author: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
Date:   Sat May  5 16:35:49 2012 +0200

nv50/ir/opt: don't lose saturation in tryCollapseChainedMULs

---

 .../drivers/nv50/codegen/nv50_ir_peephole.cpp      |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp
index db5195c..10382d9 100644
--- a/src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nv50/codegen/nv50_ir_peephole.cpp
@@ -564,7 +564,7 @@ ConstantFolding::tryCollapseChainedMULs(Instruction *mul2,
       insn = mul2->getSrc(t)->getInsn();
       if (!mul2->src(t).mod && insn->op == OP_MUL && insn->dType == TYPE_F32)
          mul1 = insn;
-      if (mul1) {
+      if (mul1 && !mul1->saturate) {
          int s1;
 
          if (mul1->src(s1 = 0).getImmediate(imm1) ||
@@ -584,10 +584,11 @@ ConstantFolding::tryCollapseChainedMULs(Instruction *mul2,
             if (f < 0)
                mul1->src(0).mod *= Modifier(NV50_IR_MOD_NEG);
          }
+         mul1->saturate = mul2->saturate;
          return;
       }
    }
-   if (mul2->getDef(0)->refCount() == 1) {
+   if (mul2->getDef(0)->refCount() == 1 && !mul2->saturate) {
       // b = mul a, imm
       // d = mul b, c   -> d = mul_x_imm a, c
       int s2, t2;




More information about the mesa-commit mailing list