On 10/29/2013 12:04 PM, Sebastian Macke wrote: > { > int lab = gen_new_label(); > - dc->btaken = tcg_temp_local_new(); > - tcg_gen_movi_tl(jmp_pc, dc->pc+8); > - tcg_gen_movi_tl(dc->btaken, 0); > + tcg_gen_movi_tl(jmp_pc, 0); > tcg_gen_brcondi_i32(op0 == 0x03 ? TCG_COND_NE : TCG_COND_EQ, > cpu_srf, 0, lab); > - tcg_gen_movi_tl(dc->btaken, 1); > tcg_gen_movi_tl(jmp_pc, tmp_pc); > gen_set_label(lab);
You can now use movcond here: tcg_gen_movi_i32(jmp_pc, tmp_pc); tcg_gen_movcond_i32(jmp_pc, cpu_srf, zero, jmp_pc, zero, op0 == 0x03 ? TCG_COND_NE : TCG_COND_EQ); Although I'd wonder about just using setcond instead, since I think the value stored in jmp_pc here is also stored in dc->j_target, leading to the right behaviour... > case JUMP_BRANCH: > { > int l1 = gen_new_label(); > - tcg_gen_brcondi_tl(TCG_COND_NE, dc->btaken, 0, l1); > + tcg_gen_brcondi_tl(TCG_COND_NE, jmp_pc, 0, l1); > gen_goto_tb(dc, 1, dc->pc); > gen_set_label(l1); > - tcg_temp_free(dc->btaken); > gen_goto_tb(dc, 0, dc->j_target); > break; ... here. > + case JUMP_BRANCH_DELAYED: > + { > + int l1 = gen_new_label(); > + tcg_gen_brcondi_tl(TCG_COND_NE, jmp_pc, 0, l1); > + gen_goto_tb(dc, 1, dc->pc); > + gen_set_label(l1); > + tcg_gen_mov_tl(cpu_pc, jmp_pc); > + tcg_gen_exit_tb(0); > + break; ... > + > + dc->delayed_branch = !!(dc->tb_flags & D_FLAG); > + if ((dc->delayed_branch) && (dc->tb_flags&B_FLAG)) { > + dc->j_state = JUMP_BRANCH_DELAYED; > + } > + And thus I can't see how these additions are actually useful? If I've missed something, and the last hunk needs to be retained, then please fix the coding style: if (dc->delayed_branch && (dc->tb_flags & B_FLAG)) { r~