From 2ff3ab0aed747cbb59d3b71ef459e70e9d346cdd Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Fri, 28 May 2021 16:03:16 +0200 Subject: [PATCH] ir3: Make MOVMSK use repeat MOVMSK is a bit of a special case, because it takes multiple cycles (and therefore reduces the nops needed if it's between some other assigner and consumer) however weird things happen if you try to start reading the first component while it isn't finished yet. On balance making it use repeat seems to result in a fewer special cases. Part-of: --- src/freedreno/ir3/ir3.h | 1 + src/freedreno/ir3/ir3_delay.c | 6 ++++++ src/freedreno/ir3/ir3_parser.y | 1 + src/freedreno/isa/ir3-cat1.xml | 10 ---------- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/freedreno/ir3/ir3.h b/src/freedreno/ir3/ir3.h index 23762bd4936..9f9c0477d5d 100644 --- a/src/freedreno/ir3/ir3.h +++ b/src/freedreno/ir3/ir3.h @@ -1677,6 +1677,7 @@ ir3_MOVMSK(struct ir3_block *block, unsigned components) struct ir3_register *dst = __ssa_dst(instr); dst->flags |= IR3_REG_SHARED; dst->wrmask = (1 << components) - 1; + instr->repeat = components - 1; return instr; } diff --git a/src/freedreno/ir3/ir3_delay.c b/src/freedreno/ir3/ir3_delay.c index 006da3c6729..08fbf276646 100644 --- a/src/freedreno/ir3/ir3_delay.c +++ b/src/freedreno/ir3/ir3_delay.c @@ -247,6 +247,12 @@ delay_calc_srcn_postra(struct ir3_instruction *assigner, struct ir3_instruction if ((src->flags & IR3_REG_RELATIV) || (dst->flags & IR3_REG_RELATIV)) return delay; + /* MOVMSK seems to require that all users wait until the entire + * instruction is finished, so just bail here. + */ + if (assigner->opc == OPC_MOVMSK) + return delay; + /* TODO: Handle the combination of (rpt) and different component sizes * better like below. This complicates things significantly because the * components don't line up. diff --git a/src/freedreno/ir3/ir3_parser.y b/src/freedreno/ir3/ir3_parser.y index 47ca9eb0f59..ffc0f76b778 100644 --- a/src/freedreno/ir3/ir3_parser.y +++ b/src/freedreno/ir3/ir3_parser.y @@ -800,6 +800,7 @@ cat1_movmsk: T_OP_MOVMSK '.' T_W { new_instr(OPC_MOVMSK); instr->cat1.src_type = TYPE_U32; instr->cat1.dst_type = TYPE_U32; + instr->repeat = $3 - 1; } dst_reg { instr->dsts[0]->wrmask = (1 << $3) - 1; } diff --git a/src/freedreno/isa/ir3-cat1.xml b/src/freedreno/isa/ir3-cat1.xml index ed9fe59f016..384de201626 100644 --- a/src/freedreno/isa/ir3-cat1.xml +++ b/src/freedreno/isa/ir3-cat1.xml @@ -457,16 +457,6 @@ SOFTWARE. 011 00 11 - - - - util_last_bit(src->dsts[0]->wrmask) - 1 -