panfrost: Rectify doubleplusungood extended branch
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sun, 17 Feb 2019 22:05:36 +0000 (22:05 +0000)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Thu, 21 Feb 2019 07:07:39 +0000 (07:07 +0000)
Midgard features "compact branches" and "extended branches", i.e.
corresponds to short jumps and far jumps. The form of the extended
branch was previously incorrect in the ISA headers; this patch corrects
it and updates the disassembler (simultaneous to preserve
bisectability).

Additionally, we fix some a corner case in the disassembly of extended
branches, and we now prefix extended branches with "brx", to visually
differentiate from compact branches prefixed with "br".

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
src/gallium/drivers/panfrost/midgard/disassemble.c
src/gallium/drivers/panfrost/midgard/midgard.h

index afde3fdbbcd405c54a64af0fd10f9cee655fbe26..7e5c5803f75da61fbb5294bb5d8d1282d19d5ffc 100644 (file)
@@ -373,6 +373,10 @@ static void
 print_branch_op(int op)
 {
         switch (op) {
+        case midgard_jmp_writeout_op_branch_uncond:
+                printf("uncond.");
+                break;
+
         case midgard_jmp_writeout_op_branch_cond:
                 printf("cond.");
                 break;
@@ -412,6 +416,7 @@ print_branch_cond(int cond)
                 break;
 
         default:
+                printf("unk%X", cond);
                 break;
         }
 }
@@ -470,17 +475,13 @@ print_extended_branch_writeout_field(uint8_t *words)
         midgard_branch_extended br;
         memcpy((char *) &br, (char *) words, sizeof(br));
 
-        printf("br.");
+        printf("brx.");
 
         print_branch_op(br.op);
         print_branch_cond(br.cond);
 
-        /* XXX: This can't be right */
         if (br.unknown)
-                printf(".unknown%d\n", br.unknown);
-
-        if (br.zero)
-                printf(".zero%d\n", br.zero);
+                printf(".unknown%d", br.unknown);
 
         printf(" ");
 
index b6cd38a5cd07e08ca308c2aec890adb675d591f4..04e195a635dc88ca9097df41632ef3fa05a841f1 100644 (file)
@@ -231,8 +231,7 @@ __attribute__((__packed__))
         midgard_jmp_writeout_op op : 3; /* == branch_cond */
         unsigned dest_tag : 4; /* tag of branch destination */
         unsigned unknown : 2;
-        signed offset : 7;
-        unsigned zero : 16;
+        signed offset : 23;
         unsigned cond : 16;
 }
 midgard_branch_extended;