Mesa (master): vc4: Reduce MOV special-casing in QIR-to-QPU.

Eric Anholt anholt at kemper.freedesktop.org
Mon Oct 26 23:52:24 UTC 2015


Module: Mesa
Branch: master
Commit: a7b424e835269d9aab6ba9b7b23f836474682725
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a7b424e835269d9aab6ba9b7b23f836474682725

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Oct 26 14:07:44 2015 -0700

vc4: Reduce MOV special-casing in QIR-to-QPU.

I'm going to introduce some more types of MOV, which also want the elision
of raw MOVs.

---

 src/gallium/drivers/vc4/vc4_qpu_emit.c |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_qpu_emit.c b/src/gallium/drivers/vc4/vc4_qpu_emit.c
index cf493d6..21db367 100644
--- a/src/gallium/drivers/vc4/vc4_qpu_emit.c
+++ b/src/gallium/drivers/vc4/vc4_qpu_emit.c
@@ -209,6 +209,11 @@ vc4_generate_code(struct vc4_context *vc4, struct vc4_compile *c)
                         M(V8ADDS),
                         M(V8SUBS),
                         M(MUL24),
+
+                        /* If we replicate src[0] out to src[1], this works
+                         * out the same as a MOV.
+                         */
+                        [QOP_MOV] = { QPU_A_OR },
                 };
 
                 struct qpu_reg src[4];
@@ -264,14 +269,6 @@ vc4_generate_code(struct vc4_context *vc4, struct vc4_compile *c)
                 }
 
                 switch (qinst->op) {
-                case QOP_MOV:
-                        /* Skip emitting the MOV if it's a no-op. */
-                        if (qir_is_raw_mov(qinst) ||
-                            dst.mux != src[0].mux || dst.addr != src[0].addr) {
-                                queue(c, qpu_a_MOV(dst, src[0]));
-                        }
-                        break;
-
                 case QOP_SEL_X_0_ZS:
                 case QOP_SEL_X_0_ZC:
                 case QOP_SEL_X_0_NS:
@@ -490,6 +487,12 @@ vc4_generate_code(struct vc4_context *vc4, struct vc4_compile *c)
                         assert(qinst->op < ARRAY_SIZE(translate));
                         assert(translate[qinst->op].op != 0); /* NOPs */
 
+                        /* Skip emitting the MOV if it's a no-op. */
+                        if (qir_is_raw_mov(qinst) &&
+                            dst.mux == src[0].mux && dst.addr == src[0].addr) {
+                                break;
+                        }
+
                         /* If we have only one source, put it in the second
                          * argument slot as well so that we don't take up
                          * another raddr just to get unused data.




More information about the mesa-commit mailing list