ir3/opt_predicates: move some helpers up

We'll need them earlier in the next commit.

Signed-off-by: Job Noorman <jnoorman@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36614>
This commit is contained in:
Job Noorman 2025-08-19 08:35:38 +02:00 committed by Marge Bot
parent 0223ab01b7
commit cccb3ecc6a

View file

@ -30,6 +30,19 @@ struct opt_predicates_ctx {
struct hash_table *predicate_clones;
};
static bool
is_shared_or_const(struct ir3_register *reg)
{
return reg->flags & (IR3_REG_CONST | IR3_REG_SHARED);
}
static bool
cat2_needs_scalar_alu(struct ir3_instruction *instr)
{
return is_shared_or_const(instr->srcs[0]) &&
(instr->srcs_count == 1 || is_shared_or_const(instr->srcs[1]));
}
static struct ir3_instruction *
clone_with_predicate_dst(struct opt_predicates_ctx *ctx,
struct ir3_instruction *instr)
@ -49,19 +62,6 @@ clone_with_predicate_dst(struct opt_predicates_ctx *ctx,
return clone;
}
static bool
is_shared_or_const(struct ir3_register *reg)
{
return reg->flags & (IR3_REG_CONST | IR3_REG_SHARED);
}
static bool
cat2_needs_scalar_alu(struct ir3_instruction *instr)
{
return is_shared_or_const(instr->srcs[0]) &&
(instr->srcs_count == 1 || is_shared_or_const(instr->srcs[1]));
}
static bool
can_write_predicate(struct opt_predicates_ctx *ctx,
struct ir3_instruction *instr)