pan/bi: Add bi_load32_components helper

Pattern seems to crop up a lot.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4276>
This commit is contained in:
Alyssa Rosenzweig 2020-03-20 11:52:33 -04:00 committed by Marge Bot
parent 8bb16138b6
commit 908341ea3f
2 changed files with 11 additions and 0 deletions

View file

@ -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)
{

View file

@ -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 */