Mesa (master): panfrost: Verify and print brx condition in disasm

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Feb 21 07:09:45 UTC 2019


Module: Mesa
Branch: master
Commit: 705723e6bef61b3937d5a4928e58b63d4c70f18c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=705723e6bef61b3937d5a4928e58b63d4c70f18c

Author: Alyssa Rosenzweig <alyssa at rosenzweig.io>
Date:   Mon Feb 18 04:29:20 2019 +0000

panfrost: Verify and print brx condition in disasm

The condition code in extended branches is repeated 8 times for unclear
reasons; accordingly, the code would be disassembled as "unknown5555",
"unknownAAAA", etc. This patch correctly masks off the lower two bits to
find the true code to print, verifying that the code is repeated as
believed to be necessary (providing some assurance for compiler quality
and an assert trip in case we encounter a shader in the wild that breaks
the convention).

Signed-off-by: Alyssa Rosenzweig <alyssa at rosenzweig.io>

---

 src/gallium/drivers/panfrost/midgard/disassemble.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/panfrost/midgard/disassemble.c b/src/gallium/drivers/panfrost/midgard/disassemble.c
index 7e5c5803f75..66d32d942c4 100644
--- a/src/gallium/drivers/panfrost/midgard/disassemble.c
+++ b/src/gallium/drivers/panfrost/midgard/disassemble.c
@@ -478,7 +478,16 @@ print_extended_branch_writeout_field(uint8_t *words)
         printf("brx.");
 
         print_branch_op(br.op);
-        print_branch_cond(br.cond);
+
+        /* Condition repeated 8 times in all known cases. Check this. */
+
+        unsigned cond = br.cond & 0x3;
+
+        for (unsigned i = 0; i < 16; i += 2) {
+                assert(((br.cond >> i) & 0x3) == cond);
+        }
+
+        print_branch_cond(cond);
 
         if (br.unknown)
                 printf(".unknown%d", br.unknown);




More information about the mesa-commit mailing list