From d815b2490b2da3c68aa4de951006d1c5f5470da2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 6 Aug 2014 12:34:00 -0700 Subject: [PATCH] vc4: Fix register aliasing for packing of scaled coordinates. Fixes glean fragProg1's "ADD test" and likely many others. --- src/gallium/drivers/vc4/vc4_qpu_emit.c | 29 ++++++++++++++++---------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/gallium/drivers/vc4/vc4_qpu_emit.c b/src/gallium/drivers/vc4/vc4_qpu_emit.c index 847f9babb25..2eebabee419 100644 --- a/src/gallium/drivers/vc4/vc4_qpu_emit.c +++ b/src/gallium/drivers/vc4/vc4_qpu_emit.c @@ -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)); -- 2.30.2