From 28c95cc40282c522ed0b89d1db2fd88b690f43b0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Sch=C3=BCrmann?= Date: Wed, 4 Dec 2019 13:41:37 +0100 Subject: [PATCH] aco: return to loop_active mask at continue_or_break blocks Reviewed-by: Rhys Perry --- src/amd/compiler/aco_insert_exec_mask.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/amd/compiler/aco_insert_exec_mask.cpp b/src/amd/compiler/aco_insert_exec_mask.cpp index 607b4f52793..606497302f7 100644 --- a/src/amd/compiler/aco_insert_exec_mask.cpp +++ b/src/amd/compiler/aco_insert_exec_mask.cpp @@ -914,20 +914,11 @@ void add_branch_code(exec_ctx& ctx, Block* block) assert(block->instructions.back()->opcode == aco_opcode::p_branch); block->instructions.pop_back(); - if (ctx.info[idx].exec.back().second & mask_type_loop) { - bld.branch(aco_opcode::p_cbranch_nz, bld.exec(ctx.info[idx].exec.back().first), block->linear_succs[1], block->linear_succs[0]); - } else { - Temp cond = Temp(); - for (int exec_idx = ctx.info[idx].exec.size() - 1; exec_idx >= 0; exec_idx--) { - if (ctx.info[idx].exec[exec_idx].second & mask_type_loop) { - cond = bld.sopc(Builder::s_cmp_lg, bld.def(s1, scc), ctx.info[idx].exec[exec_idx].first, Operand(0u)); - break; - } - } - assert(cond != Temp()); + while (!(ctx.info[idx].exec.back().second & mask_type_loop)) + ctx.info[idx].exec.pop_back(); - bld.branch(aco_opcode::p_cbranch_nz, bld.scc(cond), block->linear_succs[1], block->linear_succs[0]); - } + ctx.info[idx].exec.back().first = bld.pseudo(aco_opcode::p_parallelcopy, bld.def(bld.lm, exec), ctx.info[idx].exec.back().first); + bld.branch(aco_opcode::p_cbranch_nz, bld.exec(ctx.info[idx].exec.back().first), block->linear_succs[1], block->linear_succs[0]); return; } -- 2.30.2