From c3e7384bbb2cfc56aed6244949d896db233d35f3 Mon Sep 17 00:00:00 2001 From: Job Noorman Date: Tue, 7 Jan 2025 10:51:47 +0100 Subject: [PATCH] ir3: always set wrmask for movmsk We failed to set the wrmask of movmsk expanded from ballot.macro. This caused legalization to miss the need for (ss) when a component other than the first is used. Signed-off-by: Job Noorman Fixes: 1a78604d201 ("ir3: Add support for subgroup arithmetic") Part-of: --- src/freedreno/ir3/ir3_lower_subgroups.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/freedreno/ir3/ir3_lower_subgroups.c b/src/freedreno/ir3/ir3_lower_subgroups.c index 9592f70c5a0..310bcc857ff 100644 --- a/src/freedreno/ir3/ir3_lower_subgroups.c +++ b/src/freedreno/ir3/ir3_lower_subgroups.c @@ -468,10 +468,13 @@ lower_instr(struct ir3 *ir, struct ir3_block **block, struct ir3_instruction *in break; case OPC_BALLOT_MACRO: { - unsigned comp_count = util_last_bit(instr->dsts[0]->wrmask); + unsigned wrmask = instr->dsts[0]->wrmask; + unsigned comp_count = util_last_bit(wrmask); struct ir3_instruction *movmsk = ir3_instr_create_at( ir3_before_terminator(then_block), OPC_MOVMSK, 1, 0); - ir3_dst_create(movmsk, instr->dsts[0]->num, instr->dsts[0]->flags); + struct ir3_register *dst = + ir3_dst_create(movmsk, instr->dsts[0]->num, instr->dsts[0]->flags); + dst->wrmask = wrmask; movmsk->repeat = comp_count - 1; break; }