nvc0/ir/emit: fix modifiers of f32 add with long immediate
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Fri, 6 Jan 2012 23:21:57 +0000 (00:21 +0100)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Mon, 9 Jan 2012 23:36:59 +0000 (00:36 +0100)
src/gallium/drivers/nvc0/codegen/nv50_ir_emit_nvc0.cpp

index ecff42106da30c920642040b5b7c91fb30bc722f..da2c885eb87b7613f51abb48672431de9782e51f 100644 (file)
@@ -511,20 +511,26 @@ CodeEmitterNVC0::emitFADD(const Instruction *i)
 {
    if (i->encSize == 8) {
       if (isLIMM(i->src[1], TYPE_F32)) {
+         assert(!i->saturate);
          emitForm_A(i, HEX64(28000000, 00000002));
 
-         assert(!i->src[1].mod.neg() && !i->src[1].mod.abs() && !i->saturate);
+         code[0] |= i->src[0].mod.abs() << 7;
+         code[0] |= i->src[0].mod.neg() << 9;
+
+         if (i->src[1].mod.abs())
+            code[1] &= 0xfdffffff;
+         if ((i->op == OP_SUB) != static_cast<bool>(i->src[1].mod.neg()))
+            code[1] ^= 0x02000000;
       } else {
          emitForm_A(i, HEX64(50000000, 00000000));
 
          roundMode_A(i);
          if (i->saturate)
             code[1] |= 1 << 17;
-      }
-      emitNegAbs12(i);
-
-      if (i->op == OP_SUB) code[0] ^= 1 << 8;
 
+         emitNegAbs12(i);
+         if (i->op == OP_SUB) code[0] ^= 1 << 8;
+      }
       if (i->ftz)
          code[0] |= 1 << 5;
    } else {