mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 06:48:06 +02:00
pan/midgard: Expand 64-bit writemasks
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
This commit is contained in:
parent
bda3ec5d55
commit
855eec93b1
2 changed files with 11 additions and 7 deletions
|
|
@ -244,17 +244,19 @@ struct mir_ldst_op_props {
|
||||||
/* This file is common, so don't define the tables themselves. #include
|
/* This file is common, so don't define the tables themselves. #include
|
||||||
* midgard_op.h if you need that, or edit midgard_ops.c directly */
|
* midgard_op.h if you need that, or edit midgard_ops.c directly */
|
||||||
|
|
||||||
/* Duplicate bits to convert a 4-bit writemask to duplicated 8-bit format,
|
/* Duplicate bits to convert a per-component to duplicated 8-bit format,
|
||||||
* which is used for 32-bit vector units */
|
* which is used for vector units */
|
||||||
|
|
||||||
static inline unsigned
|
static inline unsigned
|
||||||
expand_writemask_32(unsigned mask)
|
expand_writemask(unsigned mask, unsigned channels)
|
||||||
{
|
{
|
||||||
unsigned o = 0;
|
unsigned o = 0;
|
||||||
|
unsigned factor = 8 / channels;
|
||||||
|
unsigned expanded = (1 << factor) - 1;
|
||||||
|
|
||||||
for (int i = 0; i < 4; ++i)
|
for (unsigned i = 0; i < channels; ++i)
|
||||||
if (mask & (1 << i))
|
if (mask & (1 << i))
|
||||||
o |= (3 << (2 * i));
|
o |= (expanded << (factor * i));
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -279,8 +279,10 @@ emit_alu_bundle(compiler_context *ctx,
|
||||||
midgard_scalar_alu scalarized;
|
midgard_scalar_alu scalarized;
|
||||||
|
|
||||||
if (ins->unit & UNITS_ANY_VECTOR) {
|
if (ins->unit & UNITS_ANY_VECTOR) {
|
||||||
if (ins->alu.reg_mode == midgard_reg_mode_32)
|
if (ins->alu.reg_mode == midgard_reg_mode_64)
|
||||||
ins->alu.mask = expand_writemask_32(ins->mask);
|
ins->alu.mask = expand_writemask(ins->mask, 2);
|
||||||
|
else if (ins->alu.reg_mode == midgard_reg_mode_32)
|
||||||
|
ins->alu.mask = expand_writemask(ins->mask, 4);
|
||||||
else
|
else
|
||||||
ins->alu.mask = ins->mask;
|
ins->alu.mask = ins->mask;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue