From 7e0b868cf31003ada12063398fb91485ed8043dd Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 21 Aug 2015 00:04:36 -0700 Subject: [PATCH] vc4: Reuse QPU dumping for packing bits in QIR. --- src/gallium/drivers/vc4/vc4_qir.c | 25 +++++-------------------- src/gallium/drivers/vc4/vc4_qpu.h | 7 +++++++ src/gallium/drivers/vc4/vc4_qpu_disasm.c | 16 ++++++++++++++-- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/gallium/drivers/vc4/vc4_qir.c b/src/gallium/drivers/vc4/vc4_qir.c index 4e0dc38..e5efb7cb 100644 --- a/src/gallium/drivers/vc4/vc4_qir.c +++ b/src/gallium/drivers/vc4/vc4_qir.c @@ -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++) { diff --git a/src/gallium/drivers/vc4/vc4_qpu.h b/src/gallium/drivers/vc4/vc4_qpu.h index fbb90ba..0719d28 100644 --- a/src/gallium/drivers/vc4/vc4_qpu.h +++ b/src/gallium/drivers/vc4/vc4_qpu.h @@ -24,6 +24,7 @@ #ifndef VC4_QPU_H #define VC4_QPU_H +#include #include #include "util/u_math.h" @@ -206,6 +207,12 @@ 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); #endif /* VC4_QPU_H */ diff --git a/src/gallium/drivers/vc4/vc4_qpu_disasm.c b/src/gallium/drivers/vc4/vc4_qpu_disasm.c index 00aeb30..0879787 100644 --- a/src/gallium/drivers/vc4/vc4_qpu_disasm.c +++ b/src/gallium/drivers/vc4/vc4_qpu_disasm.c @@ -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); } } -- 2.7.4