nv50/ir: fix emission of address reg in 3rd source
authorIlia Mirkin <imirkin@alum.mit.edu>
Tue, 30 Jun 2015 06:46:26 +0000 (02:46 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Tue, 30 Jun 2015 06:51:14 +0000 (02:51 -0400)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91056
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org>
src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp

index 1bfc8e32e849e4b6211c7c41fa6803a9decf1533..6de8f45047af5aa737005b620bcf75abe2dcc263 100644 (file)
@@ -499,10 +499,14 @@ CodeEmitterNV50::emitForm_MAD(const Instruction *i)
    setSrc(i, 2, 2);
 
    if (i->getIndirect(0, 0)) {
-      assert(!i->getIndirect(1, 0));
+      assert(!i->srcExists(1) || !i->getIndirect(1, 0));
+      assert(!i->srcExists(2) || !i->getIndirect(2, 0));
       setAReg16(i, 0);
-   } else {
+   } else if (i->srcExists(1) && i->getIndirect(1, 0)) {
+      assert(!i->srcExists(2) || !i->getIndirect(2, 0));
       setAReg16(i, 1);
+   } else {
+      setAReg16(i, 2);
    }
 }