panfrost/midgard: Fix mir_print_instruction() for branch instructions
authorBoris Brezillon <boris.brezillon@collabora.com>
Mon, 20 Jan 2020 20:44:49 +0000 (21:44 +0100)
committerMarge Bot <eric+marge@anholt.net>
Wed, 22 Jan 2020 15:31:28 +0000 (15:31 +0000)
Branch instructions should not be treated as regular ALUs.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3478>

src/panfrost/midgard/midgard_print.c

index 43bb671dc66b79a50c114be92e93c0f32679b4bb..36a582599317c931c22ba11cff2d89aa3e404d5e 100644 (file)
@@ -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));