[Mesa-dev] [PATCH v2 2/2] nvc0/ir: always use limm form for log ops with immediates

Karol Herbst kherbst at redhat.com
Mon Mar 19 15:33:51 UTC 2018


In the short imm form 0x80000 was sign-extended to 0xfff80000 which leads to
wrong results.

Fix setting the NOT modifier on immediate sources as well, because this is not
legal anyway.

v2: add an assert and move setting the NOT modifier

Signed-off-by: Karol Herbst <kherbst at redhat.com>
---
 src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp
index 58594f02c7f..e2c41a0e264 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp
@@ -887,7 +887,8 @@ CodeEmitterNVC0::emitLogicOp(const Instruction *i, uint8_t subOp)
       }
    } else
    if (i->encSize == 8) {
-      if (isLIMM(i->src(1), TYPE_U32)) {
+      if (i->src(1).getFile() == FILE_IMMEDIATE) {
+         assert(!i->src(1).mod);
          emitForm_A(i, HEX64(38000000, 00000002));
 
          if (i->flagsDef >= 0)
@@ -897,6 +898,8 @@ CodeEmitterNVC0::emitLogicOp(const Instruction *i, uint8_t subOp)
 
          if (i->flagsDef >= 0)
             code[1] |= 1 << 16;
+
+         if (i->src(1).mod & Modifier(NV50_IR_MOD_NOT)) code[0] |= 1 << 8;
       }
       code[0] |= subOp << 6;
 
@@ -904,7 +907,6 @@ CodeEmitterNVC0::emitLogicOp(const Instruction *i, uint8_t subOp)
          code[0] |= 1 << 5;
 
       if (i->src(0).mod & Modifier(NV50_IR_MOD_NOT)) code[0] |= 1 << 9;
-      if (i->src(1).mod & Modifier(NV50_IR_MOD_NOT)) code[0] |= 1 << 8;
    } else {
       emitForm_S(i, (subOp << 5) |
                  ((i->src(1).getFile() == FILE_IMMEDIATE) ? 0x1d : 0x8d), true);
-- 
2.14.3



More information about the mesa-dev mailing list