diff options
author | Alyssa Rosenzweig <[email protected]> | 2020-04-28 17:43:56 -0400 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-04-29 15:35:54 +0000 |
commit | 95664b177f4effeae9e3e3cc1cc97629a0d1db6d (patch) | |
tree | ec452446c4d60bc5204f4b12fa47b3a61d61181c /src/panfrost/midgard | |
parent | efc9ab6dcced7b8afc8e9dd9f201124ca8d00797 (diff) |
pan/mdg: Move condense_writemask to disasm
The compiler should *never* use this. Packing should be 1 way.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4793>
Diffstat (limited to 'src/panfrost/midgard')
-rw-r--r-- | src/panfrost/midgard/disassemble.c | 22 | ||||
-rw-r--r-- | src/panfrost/midgard/helpers.h | 22 |
2 files changed, 22 insertions, 22 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) { diff --git a/src/panfrost/midgard/helpers.h b/src/panfrost/midgard/helpers.h index 7aa2e776008..658c43b785d 100644 --- a/src/panfrost/midgard/helpers.h +++ b/src/panfrost/midgard/helpers.h @@ -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 |