summaryrefslogtreecommitdiffstats
path: root/src/panfrost
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-11-04 22:20:59 -0500
committerAlyssa Rosenzweig <[email protected]>2019-11-15 20:08:46 +0000
commit855eec93b10579ffdffada8dc39b87314db4e646 (patch)
treec7233f6f8f9855f3602f8bc769c66336ce2c5b7b /src/panfrost
parentbda3ec5d5507dd10a62e87fc676eeeac93446e3f (diff)
pan/midgard: Expand 64-bit writemasks
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/panfrost')
-rw-r--r--src/panfrost/midgard/helpers.h12
-rw-r--r--src/panfrost/midgard/midgard_emit.c6
2 files changed, 11 insertions, 7 deletions
diff --git a/src/panfrost/midgard/helpers.h b/src/panfrost/midgard/helpers.h
index b8600118260..9cfb9fe780f 100644
--- a/src/panfrost/midgard/helpers.h
+++ b/src/panfrost/midgard/helpers.h
@@ -244,17 +244,19 @@ struct mir_ldst_op_props {
/* 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 */
-/* Duplicate bits to convert a 4-bit writemask to duplicated 8-bit format,
- * which is used for 32-bit vector units */
+/* Duplicate bits to convert a per-component to duplicated 8-bit format,
+ * which is used for vector units */
static inline unsigned
-expand_writemask_32(unsigned mask)
+expand_writemask(unsigned mask, unsigned channels)
{
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))
- o |= (3 << (2 * i));
+ o |= (expanded << (factor * i));
return o;
}
diff --git a/src/panfrost/midgard/midgard_emit.c b/src/panfrost/midgard/midgard_emit.c
index 0ba404d13e8..57f8726c770 100644
--- a/src/panfrost/midgard/midgard_emit.c
+++ b/src/panfrost/midgard/midgard_emit.c
@@ -279,8 +279,10 @@ emit_alu_bundle(compiler_context *ctx,
midgard_scalar_alu scalarized;
if (ins->unit & UNITS_ANY_VECTOR) {
- if (ins->alu.reg_mode == midgard_reg_mode_32)
- ins->alu.mask = expand_writemask_32(ins->mask);
+ if (ins->alu.reg_mode == midgard_reg_mode_64)
+ 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
ins->alu.mask = ins->mask;