From: Eric Anholt Date: Fri, 21 Aug 2015 07:04:36 +0000 (-0700) Subject: vc4: Reuse QPU dumping for packing bits in QIR. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7e0b868cf31003ada12063398fb91485ed8043dd;p=mesa.git vc4: Reuse QPU dumping for packing bits in QIR. --- diff --git a/src/gallium/drivers/vc4/vc4_qir.c b/src/gallium/drivers/vc4/vc4_qir.c index 4e0dc385d80..e5efb7cba7e 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 fbb90ba12a0..0719d2828b5 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" @@ -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); diff --git a/src/gallium/drivers/vc4/vc4_qpu_disasm.c b/src/gallium/drivers/vc4/vc4_qpu_disasm.c index 00aeb300a9b..0879787ec03 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); } }