Lines Matching full:branch
59 Instruction* branch = pred.instructions.back().get(); in try_remove_simple_block() local
60 if (branch->opcode == aco_opcode::p_branch) { in try_remove_simple_block()
69 branch->opcode = aco_opcode::p_branch; in try_remove_simple_block()
95 /* Invert the condition. This branch now falls through to its original target. in try_remove_simple_block()
99 if (branch->opcode == aco_opcode::p_cbranch_nz) in try_remove_simple_block()
100 branch->opcode = aco_opcode::p_cbranch_z; in try_remove_simple_block()
102 branch->opcode = aco_opcode::p_cbranch_nz; in try_remove_simple_block()
105 /* Update the branch target. */ in try_remove_simple_block()
106 branch->branch().target[0] = succ_idx; in try_remove_simple_block()
170 Instruction* branch = block.instructions.back().get(); in try_merge_break_with_continue() local
171 if (branch->opcode != aco_opcode::s_cbranch_scc0) in try_merge_break_with_continue()
187 /* The branch needs to be exec zero only, otherwise we corrupt exec. */ in try_merge_break_with_continue()
193 /* merge block: copy to exec, branch */ in try_merge_break_with_continue()
209 /* Use conditional branch in merge block. */ in try_merge_break_with_continue()
219 * Otherwise, we'll need an extra branch instruction. in try_merge_break_with_continue()
223 branch->opcode = aco_opcode::s_branch; in try_merge_break_with_continue()
276 * used by a later branch. in eliminate_useless_exec_writes_in_block()
304 * Check if the branch instruction can be removed:
306 * is faster than the branch instruction itself.
310 * - The compiler stack knows that it's a divergent branch never taken
313 can_remove_branch(branch_ctx& ctx, Block& block, Pseudo_branch_instruction* branch) in can_remove_branch() argument
315 const uint32_t target = branch->target[0]; in can_remove_branch()
317 !((branch->opcode == aco_opcode::p_cbranch_z || branch->opcode == aco_opcode::p_cbranch_nz) && in can_remove_branch()
318 branch->operands[0].physReg() == exec); in can_remove_branch()
320 if (branch->never_taken) { in can_remove_branch()
331 const bool prefer_remove = branch->rarely_taken; in can_remove_branch()
335 /* Check the instructions between branch and target */ in can_remove_branch()
389 /* Under these conditions, we shouldn't remove the branch. in can_remove_branch()
413 aco_ptr<Instruction> branch = std::move(block.instructions.back()); in lower_branch_instruction() local
414 const uint32_t target = branch->branch().target[0]; in lower_branch_instruction()
417 if (can_remove_branch(ctx, block, &branch->branch())) { in lower_branch_instruction()
418 if (branch->opcode != aco_opcode::p_branch) in lower_branch_instruction()
423 /* emit branch instruction */ in lower_branch_instruction()
425 switch (branch->opcode) { in lower_branch_instruction()
432 if (branch->operands[0].physReg() == exec) in lower_branch_instruction()
434 else if (branch->operands[0].physReg() == vcc) in lower_branch_instruction()
437 assert(branch->operands[0].physReg() == scc); in lower_branch_instruction()
443 if (branch->operands[0].physReg() == exec) in lower_branch_instruction()
445 else if (branch->operands[0].physReg() == vcc) in lower_branch_instruction()
448 assert(branch->operands[0].physReg() == scc); in lower_branch_instruction()
452 default: unreachable("Unknown Pseudo branch instruction!"); in lower_branch_instruction()
500 instr_info.classes[(int)p.instructions.back()->opcode] == instr_class::branch && in try_stitch_linear_block()