nv50/ir/ra: swap copyCompound args if src is compound and dst isn't
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Thu, 28 Feb 2013 22:41:41 +0000 (23:41 +0100)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Tue, 12 Mar 2013 11:55:33 +0000 (12:55 +0100)
src/gallium/drivers/nv50/codegen/nv50_ir_ra.cpp

index dbf43d430398c177902f71c3e1b037c4f8e0e542..b6209bd162ebc389d75d645d3eca3345e653d9e1 100644 (file)
@@ -857,11 +857,20 @@ static inline uint8_t makeCompMask(int compSize, int base, int size)
    }
 }
 
+// Used when coalescing moves. The non-compound value will become one, e.g.:
+// mov b32 $r0 $r2            / merge b64 $r0d { $r0 $r1 }
+// split b64 { $r0 $r1 } $r0d / mov b64 $r0d f64 $r2d
 static inline void copyCompound(Value *dst, Value *src)
 {
    LValue *ldst = dst->asLValue();
    LValue *lsrc = src->asLValue();
 
+   if (ldst->compound && !lsrc->compound) {
+      LValue *swap = lsrc;
+      lsrc = ldst;
+      ldst = swap;
+   }
+
    ldst->compound = lsrc->compound;
    ldst->compMask = lsrc->compMask;
 }