panfrost/midgard/disasm: Catch mask errors
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Tue, 30 Apr 2019 04:52:36 +0000 (04:52 +0000)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 4 May 2019 19:08:50 +0000 (19:08 +0000)
We silently ignored certain bits of the mask, which causes issues when
disassembly 8/64-bit ops.

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

index ba1ab2bca5b09933e63d10ed174163fbd6867810..7b71a9937ff1fbf34bb5edf6f18c2e76346f55a6 100644 (file)
@@ -260,10 +260,21 @@ print_vector_field(const char *name, uint16_t *words, uint16_t reg_word,
                         mask = alu_field->mask >> 4;
                 }
         } else {
+                /* For full 32-bit, every other bit is duplicated, so we only
+                 * pick every other to find the effective mask */
+
                 mask = alu_field->mask & 1;
                 mask |= (alu_field->mask & 4) >> 1;
                 mask |= (alu_field->mask & 16) >> 2;
                 mask |= (alu_field->mask & 64) >> 3;
+
+                /* ... but verify! */
+
+                unsigned checked = alu_field->mask & 0x55;
+                unsigned opposite = alu_field->mask & 0xAA;
+
+                if ((checked << 1) != opposite)
+                        printf("/* %X */ ", alu_field->mask);
         }
 
         out_half = half;