nv50/ir: fix imul emission in the presence of an immediate
authorIlia Mirkin <imirkin@alum.mit.edu>
Fri, 11 Dec 2015 05:39:47 +0000 (00:39 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sat, 12 Dec 2015 23:10:15 +0000 (18:10 -0500)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp

index 00be37769af188373cd4c87d8740c03adf0dd633..c126c085dafb6e94a300fcba4ff23f9a6095f5a0 100644 (file)
@@ -1124,12 +1124,15 @@ CodeEmitterNV50::emitIMUL(const Instruction *i)
 {
    code[0] = 0x40000000;
 
+   if (i->src(1).getFile() == FILE_IMMEDIATE) {
+      if (i->sType == TYPE_S16)
+         code[0] |= 0x8100;
+      code[1] = 0;
+      emitForm_IMM(i);
+   } else
    if (i->encSize == 8) {
       code[1] = (i->sType == TYPE_S16) ? (0x8000 | 0x4000) : 0x0000;
-      if (i->src(1).getFile() == FILE_IMMEDIATE)
-         emitForm_IMM(i);
-      else
-         emitForm_MAD(i);
+      emitForm_MAD(i);
    } else {
       if (i->sType == TYPE_S16)
          code[0] |= 0x8100;