vc4: Add a QIR helper for whether the op is a MUL type.
authorEric Anholt <eric@anholt.net>
Wed, 19 Aug 2015 04:43:42 +0000 (21:43 -0700)
committerEric Anholt <eric@anholt.net>
Fri, 21 Aug 2015 06:42:59 +0000 (23:42 -0700)
src/gallium/drivers/vc4/vc4_qir.c
src/gallium/drivers/vc4/vc4_qir.h
src/gallium/drivers/vc4/vc4_qpu_emit.c

index a7b4bd637066a528cb3e862d1ebedf2c6b369850..f27b2d2d94904ca370e3ed0ce11c4cf2eaa9e5f4 100644 (file)
@@ -169,6 +169,18 @@ qir_is_multi_instruction(struct qinst *inst)
         return qir_op_info[inst->op].multi_instruction;
 }
 
+bool
+qir_is_mul(struct qinst *inst)
+{
+        switch (inst->op) {
+        case QOP_FMUL:
+        case QOP_MUL24:
+                return true;
+        default:
+                return false;
+        }
+}
+
 bool
 qir_is_tex(struct qinst *inst)
 {
index 5e23420f8e502ddc46f2509d0c06d6910733f559..c9ca3da203c6d071ff6448507fbd9fcf916379d3 100644 (file)
@@ -452,6 +452,7 @@ bool qir_reg_equals(struct qreg a, struct qreg b);
 bool qir_has_side_effects(struct vc4_compile *c, struct qinst *inst);
 bool qir_has_side_effect_reads(struct vc4_compile *c, struct qinst *inst);
 bool qir_is_multi_instruction(struct qinst *inst);
+bool qir_is_mul(struct qinst *inst);
 bool qir_is_tex(struct qinst *inst);
 bool qir_depends_on_flags(struct qinst *inst);
 bool qir_writes_r4(struct qinst *inst);
index 573a557f63e5d67e4dfe617fe5db943edd3cbfda..ef35f33a0eb6d994f3466a49adb64a499fc1ba1e 100644 (file)
@@ -179,10 +179,9 @@ vc4_generate_code(struct vc4_context *vc4, struct vc4_compile *c)
 
                 static const struct {
                         uint32_t op;
-                        bool is_mul;
                 } translate[] = {
-#define A(name) [QOP_##name] = {QPU_A_##name, false}
-#define M(name) [QOP_##name] = {QPU_M_##name, true}
+#define A(name) [QOP_##name] = {QPU_A_##name}
+#define M(name) [QOP_##name] = {QPU_M_##name}
                         A(FADD),
                         A(FSUB),
                         A(FMIN),
@@ -504,7 +503,7 @@ vc4_generate_code(struct vc4_context *vc4, struct vc4_compile *c)
 
                         fixup_raddr_conflict(c, dst, &src[0], &src[1]);
 
-                        if (translate[qinst->op].is_mul) {
+                        if (qir_is_mul(qinst)) {
                                 queue(c, qpu_m_alu2(translate[qinst->op].op,
                                                     dst,
                                                     src[0], src[1]));