aboutsummaryrefslogtreecommitdiffstats
path: root/src/panfrost
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2020-05-21 18:04:36 -0400
committerAlyssa Rosenzweig <[email protected]>2020-05-21 18:29:53 -0400
commit28a750c5f2a4b31c4d58165d19c91310b05a26b1 (patch)
treed028dd5a8c0265cef5b08d6e43a3a7a6ac92ebb2 /src/panfrost
parentc6c906ecdf973166d17f253d0b85894f42f62819 (diff)
pan/mdg: Eliminate expand_writemask division
Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5154>
Diffstat (limited to 'src/panfrost')
-rw-r--r--src/panfrost/midgard/helpers.h6
-rw-r--r--src/panfrost/midgard/midgard_emit.c4
2 files changed, 5 insertions, 5 deletions
diff --git a/src/panfrost/midgard/helpers.h b/src/panfrost/midgard/helpers.h
index 658c43b785d..a7177ce2f2e 100644
--- a/src/panfrost/midgard/helpers.h
+++ b/src/panfrost/midgard/helpers.h
@@ -240,13 +240,13 @@ struct mir_tag_props {
* which is used for vector units */
static inline unsigned
-expand_writemask(unsigned mask, unsigned channels)
+expand_writemask(unsigned mask, unsigned log2_channels)
{
unsigned o = 0;
- unsigned factor = 8 / channels;
+ unsigned factor = 8 >> log2_channels;
unsigned expanded = (1 << factor) - 1;
- for (unsigned i = 0; i < channels; ++i)
+ for (unsigned i = 0; i < (1 << log2_channels); ++i)
if (mask & (1 << i))
o |= (expanded << (factor * i));
diff --git a/src/panfrost/midgard/midgard_emit.c b/src/panfrost/midgard/midgard_emit.c
index c8340f9e44d..6431dc02c0e 100644
--- a/src/panfrost/midgard/midgard_emit.c
+++ b/src/panfrost/midgard/midgard_emit.c
@@ -184,9 +184,9 @@ mir_pack_mask_alu(midgard_instruction *ins)
}
if (ins->alu.reg_mode == midgard_reg_mode_32)
- ins->alu.mask = expand_writemask(effective, 4);
- else if (ins->alu.reg_mode == midgard_reg_mode_64)
ins->alu.mask = expand_writemask(effective, 2);
+ else if (ins->alu.reg_mode == midgard_reg_mode_64)
+ ins->alu.mask = expand_writemask(effective, 1);
else
ins->alu.mask = effective;
}