Mesa (master): vc4: Fix up the test for whether the unpack can be from r4.

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


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

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Oct 26 13:17:33 2015 -0700

vc4: Fix up the test for whether the unpack can be from r4.

We can do 16a/16b from float as well.  No difference on shader-db.

---

 src/gallium/drivers/vc4/vc4_qir.c               |   24 +++++++++++++++++++++++
 src/gallium/drivers/vc4/vc4_qir.h               |    1 +
 src/gallium/drivers/vc4/vc4_register_allocate.c |   10 ++--------
 3 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_qir.c b/src/gallium/drivers/vc4/vc4_qir.c
index 59a4e62..ce6618f 100644
--- a/src/gallium/drivers/vc4/vc4_qir.c
+++ b/src/gallium/drivers/vc4/vc4_qir.c
@@ -190,6 +190,30 @@ qir_is_mul(struct qinst *inst)
 }
 
 bool
+qir_is_float_input(struct qinst *inst)
+{
+        switch (inst->op) {
+        case QOP_FMUL:
+        case QOP_FADD:
+        case QOP_FSUB:
+        case QOP_FMIN:
+        case QOP_FMAX:
+        case QOP_FMINABS:
+        case QOP_FMAXABS:
+        case QOP_FTOI:
+        case QOP_UNPACK_8A_F:
+        case QOP_UNPACK_8B_F:
+        case QOP_UNPACK_8C_F:
+        case QOP_UNPACK_8D_F:
+        case QOP_UNPACK_16A_F:
+        case QOP_UNPACK_16B_F:
+                return true;
+        default:
+                return false;
+        }
+}
+
+bool
 qir_is_raw_mov(struct qinst *inst)
 {
         return (inst->op == QOP_MOV &&
diff --git a/src/gallium/drivers/vc4/vc4_qir.h b/src/gallium/drivers/vc4/vc4_qir.h
index aa4d932..1a1e0f3 100644
--- a/src/gallium/drivers/vc4/vc4_qir.h
+++ b/src/gallium/drivers/vc4/vc4_qir.h
@@ -465,6 +465,7 @@ bool qir_is_multi_instruction(struct qinst *inst);
 bool qir_is_mul(struct qinst *inst);
 bool qir_is_raw_mov(struct qinst *inst);
 bool qir_is_tex(struct qinst *inst);
+bool qir_is_float_input(struct qinst *inst);
 bool qir_depends_on_flags(struct qinst *inst);
 bool qir_writes_r4(struct qinst *inst);
 bool qir_src_needs_a_file(struct qinst *inst);
diff --git a/src/gallium/drivers/vc4/vc4_register_allocate.c b/src/gallium/drivers/vc4/vc4_register_allocate.c
index 3ced50f..2a1b6c35 100644
--- a/src/gallium/drivers/vc4/vc4_register_allocate.c
+++ b/src/gallium/drivers/vc4/vc4_register_allocate.c
@@ -283,20 +283,14 @@ vc4_register_allocate(struct vc4_context *vc4, struct vc4_compile *c)
                 }
 
                 if (qir_src_needs_a_file(inst)) {
-                        switch (inst->op) {
-                        case QOP_UNPACK_8A_F:
-                        case QOP_UNPACK_8B_F:
-                        case QOP_UNPACK_8C_F:
-                        case QOP_UNPACK_8D_F:
+                        if (qir_is_float_input(inst)) {
                                 /* Special case: these can be done as R4
                                  * unpacks, as well.
                                  */
                                 class_bits[inst->src[0].index] &= (CLASS_BIT_A |
                                                                    CLASS_BIT_R4);
-                                break;
-                        default:
+                        } else {
                                 class_bits[inst->src[0].index] &= CLASS_BIT_A;
-                                break;
                         }
                 }
                 ip++;




More information about the mesa-commit mailing list