nv50/ir: Add emit support for MAD IMM format
authorRoy Spliet <rspliet@eclipso.eu>
Fri, 6 Feb 2015 21:46:55 +0000 (22:46 +0100)
committerIlia Mirkin <imirkin@alum.mit.edu>
Tue, 10 Feb 2015 13:02:02 +0000 (08:02 -0500)
But don't enable generation of it in the opProperties, because we can't
guarantee the SDST==SRC2 constraint until after register assignment. We'll
add a post-RA folding pass to utilise this.

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp

index 23e4babfed02dce8a8aba9ce20320823297dccfd..b1e740954f56d6d561884d6c692e5c52586eaafc 100644 (file)
@@ -939,6 +939,14 @@ CodeEmitterNV50::emitFMAD(const Instruction *i)
 
    code[0] = 0xe0000000;
 
+   if (i->src(1).getFile() == FILE_IMMEDIATE) {
+      code[1] = 0;
+      emitForm_IMM(i);
+      code[0] |= neg_mul << 15;
+      code[0] |= neg_add << 22;
+      if (i->saturate)
+         code[0] |= 1 << 8;
+   } else
    if (i->encSize == 4) {
       emitForm_MUL(i);
       code[0] |= neg_mul << 15;