mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 02:38:04 +02:00
aco/insert_delay_alu: handle loop latch block before loop body
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39519>
This commit is contained in:
parent
102aca9843
commit
ade5e300ab
1 changed files with 28 additions and 0 deletions
|
|
@ -307,6 +307,28 @@ handle_block(Program* program, Block& block, delay_ctx& ctx)
|
|||
block.instructions.swap(new_instructions);
|
||||
}
|
||||
|
||||
void
|
||||
handle_loop_latch(Program* program, Block& block, delay_ctx& ctx)
|
||||
{
|
||||
/* No actual loop. */
|
||||
if (block.linear_preds.size() == 1)
|
||||
return;
|
||||
|
||||
/* The loop header is also the loop latch. */
|
||||
if (block.kind & block_kind_loop_latch)
|
||||
return;
|
||||
|
||||
unsigned i = block.index;
|
||||
while (ctx.program->blocks[i].loop_nest_depth >= block.loop_nest_depth) {
|
||||
Block& latch_block = ctx.program->blocks[i++];
|
||||
if (latch_block.loop_nest_depth == block.loop_nest_depth &&
|
||||
(latch_block.kind & block_kind_loop_latch)) {
|
||||
handle_block(program, latch_block, ctx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} /* end namespace */
|
||||
|
||||
void
|
||||
|
|
@ -321,6 +343,12 @@ insert_delay_alu(Program* program)
|
|||
if (current.instructions.empty())
|
||||
continue;
|
||||
|
||||
/* Handle the loop latch block before the loop body. */
|
||||
if (current.kind & block_kind_loop_header)
|
||||
handle_loop_latch(program, current, ctx);
|
||||
else if (current.kind & block_kind_loop_latch)
|
||||
continue;
|
||||
|
||||
handle_block(program, current, ctx);
|
||||
|
||||
/* Reset ctx if there is a jump, assuming ALU will be done
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue