nir: Add a nir_def_first_component_read() helper

Similar to nir_def_last_component_read().  Just a little nicer than
prodding at the bitmask of components read directly.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32888>
This commit is contained in:
Kenneth Graunke
2024-12-27 02:59:54 -08:00
committed by Marge Bot
parent 638fc5e472
commit 2f334e8baf

View File

@@ -5102,6 +5102,12 @@ nir_component_mask_t nir_def_components_read(const nir_def *def);
bool nir_def_all_uses_are_fsat(const nir_def *def);
bool nir_def_all_uses_ignore_sign_bit(const nir_def *def);
static inline int
nir_def_first_component_read(nir_def *def)
{
return (int)ffs(nir_def_components_read(def)) - 1;
}
static inline int
nir_def_last_component_read(nir_def *def)
{