ir3: Fix early-preamble (sy)

This is about writes to shared regs, not GPR (as early-preamble can only
use shared regs).  It's a pretty hypothetical case, but might as well
get it correct.

Fixes: 189e494249 ("ir3: Add (sy) before end of preamble when necessary")
Reported-by: Job Noorman <jnoorman@igalia.com>
Signed-off-by: Rob Clark <rob.clark@oss.qualcomm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38868>
This commit is contained in:
Rob Clark
2025-12-09 06:49:50 -08:00
committed by Marge Bot
parent 156ae6195e
commit d0bae6c1b3
2 changed files with 5 additions and 4 deletions

View File

@@ -3352,10 +3352,9 @@ regmask_get(regmask_t *regmask, struct ir3_register *reg)
}
static inline bool
regmask_get_any_gpr(regmask_t *regmask)
regmask_get_any_shared(regmask_t *regmask)
{
return BITSET_TEST_RANGE(regmask->full, 0, GPR_REG_SIZE * 2) ||
BITSET_TEST_RANGE(regmask->half, 0, GPR_REG_SIZE);
return BITSET_TEST_RANGE(regmask->shared, 0, 2 * SHARED_REG_SIZE);
}
/* ************************************************************************* */

View File

@@ -754,8 +754,10 @@ legalize_block(struct ir3_legalize_ctx *ctx, struct ir3_block *block)
n->flags |= IR3_INSTR_U;
}
/* Ensure no pending uGPR writes before EP ends: */
if ((n->opc == OPC_SHPE) && (ctx->compiler->gen >= 8) &&
regmask_get_any_gpr(&state->needs_sy)) {
block->in_early_preamble &&
regmask_get_any_shared(&state->needs_sy)) {
last_n = insert_nop_flags(ctx, state, last_n, &build, IR3_INSTR_SY);
}