mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 21:50:12 +01:00
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:
parent
efc9ab6dcc
commit
95664b177f
2 changed files with 22 additions and 22 deletions
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue