nir: add nir_def_all_uses_ignore_sign_bit

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31844>
This commit is contained in:
Georg Lehmann 2024-10-25 15:39:30 +02:00 committed by Marge Bot
parent 44fa24580f
commit 34f41abe24
2 changed files with 16 additions and 0 deletions

View file

@ -1706,6 +1706,21 @@ nir_def_all_uses_are_fsat(const nir_def *def)
return true;
}
bool
nir_def_all_uses_ignore_sign_bit(const nir_def *def)
{
nir_foreach_use(use, def) {
if (nir_src_is_if(use))
return false;
nir_instr *instr = nir_src_parent_instr(use);
if (instr->type != nir_instr_type_alu ||
nir_instr_as_alu(instr)->op != nir_op_fabs)
return false;
}
return true;
}
nir_block *
nir_block_unstructured_next(nir_block *block)
{

View file

@ -5084,6 +5084,7 @@ nir_def_replace(nir_def *def, nir_def *new_ssa)
nir_component_mask_t nir_src_components_read(const nir_src *src);
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_last_component_read(nir_def *def)