mirror of https://github.com/xemu-project/xemu.git
target/sparc: Merge gen_branch_[an] with only caller
Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
d547193616
commit
6b3e4cc685
|
@ -900,47 +900,6 @@ static void gen_branch2(DisasContext *dc, target_ulong pc1,
|
|||
gen_goto_tb(dc, 1, pc2, pc2 + 4);
|
||||
}
|
||||
|
||||
static void gen_branch_a(DisasContext *dc, target_ulong pc1)
|
||||
{
|
||||
TCGLabel *l1 = gen_new_label();
|
||||
target_ulong npc = dc->npc;
|
||||
|
||||
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_cond, 0, l1);
|
||||
|
||||
gen_goto_tb(dc, 0, npc, pc1);
|
||||
|
||||
gen_set_label(l1);
|
||||
gen_goto_tb(dc, 1, npc + 4, npc + 8);
|
||||
|
||||
dc->base.is_jmp = DISAS_NORETURN;
|
||||
}
|
||||
|
||||
static void gen_branch_n(DisasContext *dc, target_ulong pc1)
|
||||
{
|
||||
target_ulong npc = dc->npc;
|
||||
|
||||
if (npc & 3) {
|
||||
switch (npc) {
|
||||
case DYNAMIC_PC:
|
||||
case DYNAMIC_PC_LOOKUP:
|
||||
tcg_gen_mov_tl(cpu_pc, cpu_npc);
|
||||
tcg_gen_addi_tl(cpu_npc, cpu_npc, 4);
|
||||
tcg_gen_movcond_tl(TCG_COND_NE, cpu_npc,
|
||||
cpu_cond, tcg_constant_tl(0),
|
||||
tcg_constant_tl(pc1), cpu_npc);
|
||||
dc->pc = npc;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
}
|
||||
} else {
|
||||
dc->pc = npc;
|
||||
dc->jump_pc[0] = pc1;
|
||||
dc->jump_pc[1] = npc + 4;
|
||||
dc->npc = JUMP_PC;
|
||||
}
|
||||
}
|
||||
|
||||
static void gen_generic_branch(DisasContext *dc)
|
||||
{
|
||||
TCGv npc0 = tcg_constant_tl(dc->jump_pc[0]);
|
||||
|
@ -2942,10 +2901,38 @@ static bool advance_jump_uncond_always(DisasContext *dc, bool annul,
|
|||
|
||||
static bool advance_jump_cond(DisasContext *dc, bool annul, target_ulong dest)
|
||||
{
|
||||
target_ulong npc = dc->npc;
|
||||
|
||||
if (annul) {
|
||||
gen_branch_a(dc, dest);
|
||||
TCGLabel *l1 = gen_new_label();
|
||||
|
||||
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_cond, 0, l1);
|
||||
gen_goto_tb(dc, 0, npc, dest);
|
||||
gen_set_label(l1);
|
||||
gen_goto_tb(dc, 1, npc + 4, npc + 8);
|
||||
|
||||
dc->base.is_jmp = DISAS_NORETURN;
|
||||
} else {
|
||||
gen_branch_n(dc, dest);
|
||||
if (npc & 3) {
|
||||
switch (npc) {
|
||||
case DYNAMIC_PC:
|
||||
case DYNAMIC_PC_LOOKUP:
|
||||
tcg_gen_mov_tl(cpu_pc, cpu_npc);
|
||||
tcg_gen_addi_tl(cpu_npc, cpu_npc, 4);
|
||||
tcg_gen_movcond_tl(TCG_COND_NE, cpu_npc,
|
||||
cpu_cond, tcg_constant_tl(0),
|
||||
tcg_constant_tl(dest), cpu_npc);
|
||||
dc->pc = npc;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
}
|
||||
} else {
|
||||
dc->pc = npc;
|
||||
dc->jump_pc[0] = dest;
|
||||
dc->jump_pc[1] = npc + 4;
|
||||
dc->npc = JUMP_PC;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue