vc4: Move the tests for src needing to be an A register to vc4_qir.c.
authorEric Anholt <eric@anholt.net>
Sun, 11 Jan 2015 20:10:35 +0000 (09:10 +1300)
committerEric Anholt <eric@anholt.net>
Thu, 15 Jan 2015 09:19:25 +0000 (22:19 +1300)
I want it from another location.

src/gallium/drivers/vc4/vc4_qir.c
src/gallium/drivers/vc4/vc4_qir.h
src/gallium/drivers/vc4/vc4_register_allocate.c

index 40356c99ff317e30100ef8432cf40d6863e51dd8..0be60cb04bc4823f551d54ad7222529b4e65c9bd 100644 (file)
@@ -192,6 +192,28 @@ qir_depends_on_flags(struct qinst *inst)
         }
 }
 
+bool
+qir_src_needs_a_file(struct qinst *inst)
+{
+        switch (inst->op) {
+        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:
+        case QOP_UNPACK_8A_I:
+        case QOP_UNPACK_8B_I:
+        case QOP_UNPACK_8C_I:
+        case QOP_UNPACK_8D_I:
+        case QOP_UNPACK_16A_I:
+        case QOP_UNPACK_16B_I:
+                return true;
+        default:
+                return false;
+        }
+}
+
 bool
 qir_writes_r4(struct qinst *inst)
 {
index 307a79f77c679d89a911c7a0022c5d419359f200..746bff9bbf60459b71768d55bb5564ca948707a5 100644 (file)
@@ -385,6 +385,7 @@ bool qir_is_multi_instruction(struct qinst *inst);
 bool qir_depends_on_flags(struct qinst *inst);
 bool qir_writes_r4(struct qinst *inst);
 bool qir_reads_r4(struct qinst *inst);
+bool qir_src_needs_a_file(struct qinst *inst);
 struct qreg qir_follow_movs(struct qinst **defs, struct qreg reg);
 
 void qir_dump(struct vc4_compile *c);
index efd9d51eaa0e235167b1e6594fac857214590e9b..f40547b815403b4e0670181a2c17cf8eeb4d7ee7 100644 (file)
@@ -254,26 +254,14 @@ vc4_register_allocate(struct vc4_context *vc4, struct vc4_compile *c)
                                           vc4->reg_class_a);
                         break;
 
-                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:
-                case QOP_UNPACK_8A_I:
-                case QOP_UNPACK_8B_I:
-                case QOP_UNPACK_8C_I:
-                case QOP_UNPACK_8D_I:
-                case QOP_UNPACK_16A_I:
-                case QOP_UNPACK_16B_I:
-                        /* The unpack flags require an A-file src register. */
-                        ra_set_node_class(g, temp_to_node[inst->src[0].index],
-                                          vc4->reg_class_a);
-                        break;
-
                 default:
                         break;
                 }
+
+                if (qir_src_needs_a_file(inst)) {
+                        ra_set_node_class(g, temp_to_node[inst->src[0].index],
+                                          vc4->reg_class_a);
+                }
         }
 
         for (uint32_t i = 0; i < c->num_temps; i++) {