Lines Matching defs:branch
49 // TODO: keep track of branch instructions referring blocks
848 /* Find first branch after the inserted code */
850 [insert_before](const auto& branch) -> bool
851 { return (unsigned)branch.first >= insert_before; });
878 [&ctx](const auto& branch) -> bool {
879 return ((int)ctx.program->blocks[branch.second->block].offset - branch.first - 1) ==
886 /* Insert an s_nop after the branch */
894 emit_long_jump(asm_context& ctx, SOPP_instruction* branch, bool backwards,
899 Definition def_tmp_lo(branch->definitions[0].physReg(), s1);
900 Operand op_tmp_lo(branch->definitions[0].physReg(), s1);
901 Definition def_tmp_hi(branch->definitions[0].physReg().advance(4), s1);
902 Operand op_tmp_hi(branch->definitions[0].physReg().advance(4), s1);
906 if (branch->opcode != aco_opcode::s_branch) {
909 switch (branch->opcode) {
923 instr.reset(bld.sop1(aco_opcode::s_getpc_b64, branch->definitions[0]).instr);
929 branch->pass_flags = out.size();
941 bld.sop1(aco_opcode::s_setpc_b64, Operand(branch->definitions[0].physReg(), s2)).instr);
955 for (std::pair<int, SOPP_instruction*>& branch : ctx.branches) {
956 int offset = (int)ctx.program->blocks[branch.second->block].offset - branch.first - 1;
957 if ((offset < INT16_MIN || offset > INT16_MAX) && !branch.second->pass_flags) {
960 ctx.program->blocks[branch.second->block].offset < (unsigned)branch.first;
961 emit_long_jump(ctx, branch.second, backwards, long_jump);
963 out[branch.first] = long_jump[0];
964 insert_code(ctx, out, branch.first + 1, long_jump.size() - 1, long_jump.data() + 1);
970 if (branch.second->pass_flags) {
971 int after_getpc = branch.first + branch.second->pass_flags - 2;
972 offset = (int)ctx.program->blocks[branch.second->block].offset - after_getpc;
973 out[branch.first + branch.second->pass_flags - 1] = offset * 4;
975 out[branch.first] &= 0xffff0000u;
976 out[branch.first] |= (uint16_t)offset;