pan/mdg: Move condense_writemask to disasm

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>
This commit is contained in:
Alyssa Rosenzweig 2020-04-28 17:43:56 -04:00 committed by Marge Bot
parent efc9ab6dcc
commit 95664b177f
2 changed files with 22 additions and 22 deletions

View 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)
{

View 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