From fe5fbadd4624bc07fc45d87222b5b853c59f54b5 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Mon, 20 Jan 2020 21:44:49 +0100 Subject: [PATCH] panfrost/midgard: Fix mir_print_instruction() for branch instructions Branch instructions should not be treated as regular ALUs. Signed-off-by: Boris Brezillon Reviewed-by: Alyssa Rosenzweig Part-of: --- src/panfrost/midgard/midgard_print.c | 38 +++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/src/panfrost/midgard/midgard_print.c b/src/panfrost/midgard/midgard_print.c index 43bb671dc66..36a58259931 100644 --- a/src/panfrost/midgard/midgard_print.c +++ b/src/panfrost/midgard/midgard_print.c @@ -103,17 +103,41 @@ mir_print_instruction(midgard_instruction *ins) { printf("\t"); - switch (ins->type) { - case TAG_ALU_4: { - midgard_alu_op op = ins->alu.op; - const char *name = alu_opcode_props[op].name; - + if (midgard_is_branch_unit(ins->unit)) { const char *branch_target_names[] = { "goto", "break", "continue", "discard" }; - if (ins->compact_branch) - name = branch_target_names[ins->branch.target_type]; + printf("%s.", mir_get_unit(ins->unit)); + if (ins->branch.target_type == TARGET_DISCARD) + printf("discard."); + else if (ins->writeout) + printf("write."); + else if (ins->unit == ALU_ENAB_BR_COMPACT && + !ins->branch.conditional) + printf("uncond."); + else + printf("cond."); + + if (!ins->branch.conditional) + printf("always"); + else if (ins->branch.invert_conditional) + printf("false"); + else + printf("true"); + + if (ins->branch.target_type != TARGET_DISCARD) + printf(" %s -> block(%d)\n", + branch_target_names[ins->branch.target_type], + ins->branch.target_block); + + return; + } + + switch (ins->type) { + case TAG_ALU_4: { + midgard_alu_op op = ins->alu.op; + const char *name = alu_opcode_props[op].name; if (ins->unit) printf("%s.", mir_get_unit(ins->unit)); -- 2.30.2