vc4: Reuse QPU dumping for packing bits in QIR.
authorEric Anholt <eric@anholt.net>
Fri, 21 Aug 2015 07:04:36 +0000 (00:04 -0700)
committerEric Anholt <eric@anholt.net>
Fri, 21 Aug 2015 20:29:26 +0000 (13:29 -0700)
src/gallium/drivers/vc4/vc4_qir.c
src/gallium/drivers/vc4/vc4_qpu.h
src/gallium/drivers/vc4/vc4_qpu_disasm.c

index 4e0dc385d8069b8b5e2fcea0d5c0a35b5b685f3c..e5efb7cba7e9013bdc6e6b50696437e4007f2934 100644 (file)
@@ -287,26 +287,11 @@ qir_dump_inst(struct vc4_compile *c, struct qinst *inst)
 
         qir_print_reg(c, inst->dst, true);
         if (inst->dst.pack) {
-                if (qir_is_mul(inst)) {
-                        switch (inst->dst.pack) {
-                        case QPU_PACK_MUL_8888:
-                                fprintf(stderr, ".8888");
-                                break;
-                        case QPU_PACK_MUL_8A:
-                                fprintf(stderr, ".8a");
-                                break;
-                        case QPU_PACK_MUL_8B:
-                                fprintf(stderr, ".8b");
-                                break;
-                        case QPU_PACK_MUL_8C:
-                                fprintf(stderr, ".8c");
-                                break;
-                        case QPU_PACK_MUL_8D:
-                                fprintf(stderr, ".8d");
-                                break;
-                        }
-                } else {
-                        unreachable("packs only set up for MULs so far.\n");
+                if (inst->dst.pack) {
+                        if (qir_is_mul(inst))
+                                vc4_qpu_disasm_pack_mul(stderr, inst->dst.pack);
+                        else
+                                vc4_qpu_disasm_pack_a(stderr, inst->dst.pack);
                 }
         }
         for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
index fbb90ba12a02dd0d6fab5c7181c4e2b4d7ab91a5..0719d2828b5ef5c2cc43a7d8413a85947fc43838 100644 (file)
@@ -24,6 +24,7 @@
 #ifndef VC4_QPU_H
 #define VC4_QPU_H
 
+#include <stdio.h>
 #include <stdint.h>
 
 #include "util/u_math.h"
@@ -205,6 +206,12 @@ M_ALU2(V8SUBS)
 void
 vc4_qpu_disasm(const uint64_t *instructions, int num_instructions);
 
+void
+vc4_qpu_disasm_pack_mul(FILE *out, uint32_t pack);
+
+void
+vc4_qpu_disasm_pack_a(FILE *out, uint32_t pack);
+
 void
 vc4_qpu_validate(uint64_t *insts, uint32_t num_inst);
 
index 00aeb300a9b615f352c5e28275d8b37f6269d54d..0879787ec03c2dd99aba669028015d952e3a6509 100644 (file)
@@ -245,6 +245,18 @@ get_special_write_desc(int reg, bool is_a)
         return special_write[reg];
 }
 
+void
+vc4_qpu_disasm_pack_mul(FILE *out, uint32_t pack)
+{
+        fprintf(out, ".%s", DESC(qpu_pack_mul, pack));
+}
+
+void
+vc4_qpu_disasm_pack_a(FILE *out, uint32_t pack)
+{
+        fprintf(out, "%s", DESC(qpu_pack_a, pack));
+}
+
 static void
 print_alu_dst(uint64_t inst, bool is_mul)
 {
@@ -263,9 +275,9 @@ print_alu_dst(uint64_t inst, bool is_mul)
                 fprintf(stderr, "%s%d?", file, waddr);
 
         if (is_mul && (inst & QPU_PM)) {
-                fprintf(stderr, ".%s", DESC(qpu_pack_mul, pack));
+                vc4_qpu_disasm_pack_mul(stderr, pack);
         } else if (is_a && !(inst & QPU_PM)) {
-                fprintf(stderr, "%s", DESC(qpu_pack_a, pack));
+                vc4_qpu_disasm_pack_a(stderr, pack);
         }
 }