From 908341ea3fecbb80f070e31e1368d01194a05df4 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 20 Mar 2020 11:52:33 -0400 Subject: [PATCH] pan/bi: Add bi_load32_components helper Pattern seems to crop up a lot. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bir.c | 10 ++++++++++ src/panfrost/bifrost/compiler.h | 1 + 2 files changed, 11 insertions(+) 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) { diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h index 17834614672..1a777feaaac 100644 --- a/src/panfrost/bifrost/compiler.h +++ b/src/panfrost/bifrost/compiler.h @@ -531,6 +531,7 @@ bool bi_is_src_swizzled(bi_instruction *ins, unsigned s); bool bi_has_arg(bi_instruction *ins, unsigned arg); uint16_t bi_from_bytemask(uint16_t bytemask, unsigned bytes); unsigned bi_get_component_count(bi_instruction *ins); +unsigned bi_load32_components(bi_instruction *ins); uint16_t bi_bytemask_of_read_components(bi_instruction *ins, unsigned node); /* BIR passes */ -- 2.30.2