aco: allow p_exit_early_if_not with exec condition

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <None>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32731>
This commit is contained in:
Georg Lehmann 2024-12-19 20:17:55 +01:00 committed by Marge Bot
parent c279e63a79
commit 6b35d6f75b
2 changed files with 8 additions and 3 deletions

View file

@ -78,7 +78,9 @@ can_remove_branch(branch_ctx& ctx, Block& block, Pseudo_branch_instruction* bran
* an empty exec mask.
*/
if (instr->opcode == aco_opcode::s_cbranch_scc0 ||
instr->opcode == aco_opcode::s_cbranch_scc1) {
instr->opcode == aco_opcode::s_cbranch_scc1 ||
instr->opcode == aco_opcode::s_cbranch_execz ||
instr->opcode == aco_opcode::s_cbranch_execnz) {
bool is_break_continue =
ctx.program->blocks[i].kind & (block_kind_break | block_kind_continue);
bool discard_early_exit =

View file

@ -2427,8 +2427,11 @@ lower_to_hw_instr(Program* program)
bld.reset(&ctx.instructions);
}
assert(instr->operands[0].physReg() == scc);
bld.sopp(aco_opcode::s_cbranch_scc0, discard_block->index);
assert(instr->operands[0].physReg() == scc || instr->operands[0].physReg() == exec);
if (instr->operands[0].physReg() == scc)
bld.sopp(aco_opcode::s_cbranch_scc0, discard_block->index);
else
bld.sopp(aco_opcode::s_cbranch_execz, discard_block->index);
discard_block->linear_preds.push_back(block->index);
block->linear_succs.push_back(discard_block->index);