Mesa (master): nv50/ir/gk110: fix handling of OP_SUB for floating point ops

Ilia Mirkin imirkin at kemper.freedesktop.org
Tue Mar 18 09:58:23 UTC 2014


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

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Fri Mar 14 06:11:37 2014 -0400

nv50/ir/gk110: fix handling of OP_SUB for floating point ops

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>

---

 src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp
index 92fbf26..7c60837 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp
@@ -534,7 +534,10 @@ CodeEmitterGK110::emitFADD(const Instruction *i)
       assert(i->rnd == ROUND_N);
       assert(!i->saturate);
 
-      emitForm_L(i, 0x400, 0, i->src(1).mod);
+      Modifier mod = i->src(1).mod ^
+         Modifier(i->op == OP_SUB ? NV50_IR_MOD_NEG : 0);
+
+      emitForm_L(i, 0x400, 0, mod);
 
       FTZ_(3a);
       NEG_(3b, 0);
@@ -549,9 +552,11 @@ CodeEmitterGK110::emitFADD(const Instruction *i)
 
       if (code[0] & 0x1) {
          modNegAbsF32_3b(i, 1);
+         if (i->op == OP_SUB) code[1] ^= 1 << 27;
       } else {
          ABS_(34, 1);
          NEG_(30, 1);
+         if (i->op == OP_SUB) code[1] ^= 1 << 16;
       }
    }
 }




More information about the mesa-commit mailing list