ir3/legalize: don't allow end instruction as jump target on a5xx

From experiments it appears that (jp) flag on "end" instruction has no
effect (at least on a5xx). This means that we should insert "(jp)nop"
before it, which is what blob is doing too.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35331>
This commit is contained in:
Vladly 2025-06-03 14:50:37 +00:00 committed by Marge Bot
parent e1d54be524
commit 760c96628d

View file

@ -1171,6 +1171,15 @@ mark_jp(struct ir3_block *block)
struct ir3_instruction *target =
list_first_entry(&block->instr_list, struct ir3_instruction, node);
/* Add nop instruction for (jp) flag since it has no effect on a5xx when set
* on the end instruction.
*/
if (target->opc == OPC_END && block->shader->compiler->gen == 5) {
struct ir3_builder build = ir3_builder_at(ir3_before_instr(target));
target = ir3_NOP(&build);
}
target->flags |= IR3_INSTR_JP;
}