aboutsummaryrefslogtreecommitdiffstats
path: root/src/panfrost/bifrost/bir.c
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2020-03-20 11:52:33 -0400
committerMarge Bot <[email protected]>2020-03-22 03:32:35 +0000
commit908341ea3fecbb80f070e31e1368d01194a05df4 (patch)
tree0141b8beed2d8cd9d13f0d066fd29ae2e47099f0 /src/panfrost/bifrost/bir.c
parent8bb16138b658ea7eb5dfaf023463ae78f173de0e (diff)
pan/bi: Add bi_load32_components helper
Pattern seems to crop up a lot. Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4276>
Diffstat (limited to 'src/panfrost/bifrost/bir.c')
-rw-r--r--src/panfrost/bifrost/bir.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/panfrost/bifrost/bir.c b/src/panfrost/bifrost/bir.c
index 496a394acfa..5de9d30fe30 100644
--- a/src/panfrost/bifrost/bir.c
+++ b/src/panfrost/bifrost/bir.c
@@ -105,6 +105,16 @@ bi_get_component_count(bi_instruction *ins)
}
}
+unsigned
+bi_load32_components(bi_instruction *ins)
+{
+ unsigned mask = bi_from_bytemask(ins->writemask, 4);
+ unsigned count = util_bitcount(mask);
+ assert(mask == ((1 << count) - 1));
+ assert(count >= 1 && count <= 4);
+ return count;
+}
+
uint16_t
bi_bytemask_of_read_components(bi_instruction *ins, unsigned node)
{