summaryrefslogtreecommitdiffstats
path: root/src/panfrost/midgard/disassemble.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/panfrost/midgard/disassemble.c')
-rw-r--r--src/panfrost/midgard/disassemble.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/panfrost/midgard/disassemble.c b/src/panfrost/midgard/disassemble.c
index 93e11667749..8c7f718674f 100644
--- a/src/panfrost/midgard/disassemble.c
+++ b/src/panfrost/midgard/disassemble.c
@@ -49,6 +49,28 @@ static bool is_instruction_int = false;
static struct midgard_disasm_stats midg_stats;
+/* Transform an expanded writemask (duplicated 8-bit format) into its condensed
+ * form (one bit per component) */
+
+static inline unsigned
+condense_writemask(unsigned expanded_mask,
+ unsigned bits_per_component)
+{
+ if (bits_per_component == 8)
+ unreachable("XXX TODO: sort out how 8-bit constant encoding works");
+
+ unsigned slots_per_component = bits_per_component / 16;
+ unsigned max_comp = (16 * 8) / bits_per_component;
+ unsigned condensed_mask = 0;
+
+ for (unsigned i = 0; i < max_comp; i++) {
+ if (expanded_mask & (1 << (i * slots_per_component)))
+ condensed_mask |= (1 << i);
+ }
+
+ return condensed_mask;
+}
+
static void
print_alu_opcode(FILE *fp, midgard_alu_op op)
{