pan/mdg: Move condense_writemask to disasm
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 28 Apr 2020 21:43:56 +0000 (17:43 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 29 Apr 2020 15:35:54 +0000 (15:35 +0000)
The compiler should *never* use this. Packing should be 1 way.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4793>

src/panfrost/midgard/disassemble.c
src/panfrost/midgard/helpers.h

index 93e11667749e82f2735d95f554b82e78a6b154f9..8c7f718674f260fc5509cc035e7645bbff69b12b 100644 (file)
@@ -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)
 {
index 7aa2e776008738e58714e6181be14fa99388b441..658c43b785d17883034e0bd55005f47dcbf3fb6f 100644 (file)
@@ -253,28 +253,6 @@ expand_writemask(unsigned mask, unsigned channels)
         return o;
 }
 
-/* Tansform 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;
-}
-
 /* Coerce structs to integer */
 
 static inline unsigned