mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 06:48:06 +02:00
nir/search: make is_only_used_by_iadd reusable
The algorithm is exactly the same for other opcodes so we don't have to have to copy paste it. Signed-off-by: Job Noorman <jnoorman@igalia.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Rob Clark <robclark@freedesktop.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32181>
This commit is contained in:
parent
22fc90a116
commit
a8c947df9a
1 changed files with 8 additions and 2 deletions
|
|
@ -599,7 +599,7 @@ is_only_used_by_fadd(const nir_alu_instr *instr)
|
|||
}
|
||||
|
||||
static inline bool
|
||||
is_only_used_by_iadd(const nir_alu_instr *instr)
|
||||
is_only_used_by_alu_op(const nir_alu_instr *instr, nir_op op)
|
||||
{
|
||||
nir_foreach_use(src, &instr->def) {
|
||||
const nir_instr *const user_instr = nir_src_parent_instr(src);
|
||||
|
|
@ -609,13 +609,19 @@ is_only_used_by_iadd(const nir_alu_instr *instr)
|
|||
const nir_alu_instr *const user_alu = nir_instr_as_alu(user_instr);
|
||||
assert(instr != user_alu);
|
||||
|
||||
if (user_alu->op != nir_op_iadd)
|
||||
if (user_alu->op != op)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
is_only_used_by_iadd(const nir_alu_instr *instr)
|
||||
{
|
||||
return is_only_used_by_alu_op(instr, nir_op_iadd);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
only_lower_8_bits_used(const nir_alu_instr *instr)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue