From da969df0923ab91d90a91db8f7d36994c443af37 Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Wed, 10 Dec 2025 17:16:43 -0500 Subject: [PATCH] ir3: Fix condition for using uniform predicates cat2_may_use_scalar_alu() was incorrect because the instruction could use an indirectly-accessed const where a0.x (i.e. the offset) is non-uniform. Fortunately, we already know whether this is the case, because the original instruction would then write a non-shared GPR. Also, the restrictions for scalar ALU are the same regardless of whether we write up0.x or a shared GPR, and vice versa the restrictions for normal cat2 are the same regardless of whether we write p0.x or a non-shared GPR, so it should always be safe to write p0.x if non-shared and up0.x if shared. So, just do that. Fixes: 2a8c5ebc77f ("ir3: enable scalar predicates") Part-of: --- src/freedreno/ir3/ir3_opt_predicates.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/freedreno/ir3/ir3_opt_predicates.c b/src/freedreno/ir3/ir3_opt_predicates.c index c578ec35f57..0eea09b9572 100644 --- a/src/freedreno/ir3/ir3_opt_predicates.c +++ b/src/freedreno/ir3/ir3_opt_predicates.c @@ -43,13 +43,6 @@ cat2_needs_scalar_alu(struct ir3_instruction *instr) return cat2_all_srcs_have_flag(instr, IR3_REG_CONST | IR3_REG_SHARED); } -static bool -cat2_may_use_scalar_alu(struct ir3_instruction *instr) -{ - return cat2_all_srcs_have_flag( - instr, IR3_REG_CONST | IR3_REG_SHARED | IR3_REG_IMMED); -} - static struct ir3_instruction * clone_with_predicate_dst(struct opt_predicates_ctx *ctx, struct ir3_instruction *instr) @@ -67,7 +60,7 @@ clone_with_predicate_dst(struct opt_predicates_ctx *ctx, clone->dsts[0]->flags &= ~(IR3_REG_HALF | IR3_REG_SHARED); if (ctx->ir->compiler->has_scalar_predicates && opc_cat(instr->opc) == 2 && - cat2_may_use_scalar_alu(instr)) { + (instr->dsts[0]->flags & IR3_REG_SHARED)) { clone->dsts[0]->flags |= IR3_REG_UNIFORM; }