vc4: Fix register aliasing for packing of scaled coordinates.
authorEric Anholt <eric@anholt.net>
Wed, 6 Aug 2014 19:34:00 +0000 (12:34 -0700)
committerEric Anholt <eric@anholt.net>
Sat, 9 Aug 2014 01:59:47 +0000 (18:59 -0700)
Fixes glean fragProg1's "ADD test" and likely many others.

src/gallium/drivers/vc4/vc4_qpu_emit.c

index 847f9babb2526852694e443bcfb9d8992b5868bd..2eebabee419fe6b82cf3f1b6a4677b7a84e95a51 100644 (file)
@@ -470,18 +470,25 @@ vc4_generate_code(struct qcompile *c)
                                           qpu_m_NOP()));
                         break;
 
-                case QOP_PACK_SCALED:
-                        queue(c, qpu_inst(qpu_a_MOV(dst, src[0]),
-                                          qpu_m_NOP()));
-                        *last_inst(c) |= QPU_SET_FIELD(QPU_PACK_A_16A,
-                                                       QPU_PACK);
-
-                        queue(c, qpu_inst(qpu_a_MOV(dst, src[1]),
-                                          qpu_m_NOP()));
-                        *last_inst(c) |= QPU_SET_FIELD(QPU_PACK_A_16B,
-                                                       QPU_PACK);
-
+                case QOP_PACK_SCALED: {
+                        uint64_t a = (qpu_inst(qpu_a_MOV(dst, src[0]),
+                                               qpu_m_NOP()) |
+                                      QPU_SET_FIELD(QPU_PACK_A_16A,
+                                                    QPU_PACK));
+                        uint64_t b = (qpu_inst(qpu_a_MOV(dst, src[1]),
+                                               qpu_m_NOP()) |
+                                      QPU_SET_FIELD(QPU_PACK_A_16B,
+                                                    QPU_PACK));
+
+                        if (dst.mux == src[1].mux && dst.addr == src[1].addr) {
+                                queue(c, b);
+                                queue(c, a);
+                        } else {
+                                queue(c, a);
+                                queue(c, b);
+                        }
                         break;
+                }
 
                 default:
                         assert(qinst->op < ARRAY_SIZE(translate));