[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/16] target-sparc: Optmize writeback of cpu_cond
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH 14/16] target-sparc: Optmize writeback of cpu_cond |
Date: |
Mon, 10 Oct 2016 10:17:06 -0500 |
This condition variable is required for some cases of single stepping
through delay slots. But otherwise it can be produced and consumed
within a single TB.
By copying to a temporary and discarding the original when consuming
the value, we allow the TCG optimizer to avoid the writeback to ENV.
Signed-off-by: Richard Henderson <address@hidden>
---
target-sparc/translate.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/target-sparc/translate.c b/target-sparc/translate.c
index e55ca1d..158834f 100644
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -977,11 +977,14 @@ static inline void gen_op_eval_fbo(TCGv dst, TCGv src,
}
static inline void gen_branch2(DisasContext *dc, target_ulong pc1,
- target_ulong pc2, TCGv r_cond)
+ target_ulong pc2)
{
TCGLabel *l1 = gen_new_label();
+ TCGv tmp = get_temp_tl(dc);
- tcg_gen_brcondi_tl(TCG_COND_EQ, r_cond, 0, l1);
+ tcg_gen_mov_tl(tmp, cpu_cond);
+ tcg_gen_discard_tl(cpu_cond);
+ tcg_gen_brcondi_tl(TCG_COND_EQ, tmp, 0, l1);
gen_goto_tb(dc, 0, pc1, pc1 + 4);
@@ -993,8 +996,11 @@ static void gen_branch_a(DisasContext *dc, target_ulong
pc1)
{
TCGLabel *l1 = gen_new_label();
target_ulong npc = dc->npc;
+ TCGv tmp = get_temp_tl(dc);
- tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_cond, 0, l1);
+ tcg_gen_mov_tl(tmp, cpu_cond);
+ tcg_gen_discard_tl(cpu_cond);
+ tcg_gen_brcondi_tl(TCG_COND_EQ, tmp, 0, l1);
gen_goto_tb(dc, 0, npc, pc1);
@@ -1024,6 +1030,7 @@ static void gen_branch_n(DisasContext *dc, target_ulong
pc1)
tcg_gen_movcond_tl(TCG_COND_NE, cpu_npc, cpu_cond, z, t, cpu_npc);
tcg_temp_free(t);
tcg_temp_free(z);
+ tcg_gen_discard_tl(cpu_cond);
dc->pc = DYNAMIC_PC;
}
@@ -1036,6 +1043,7 @@ static inline void gen_generic_branch(DisasContext *dc)
TCGv zero = tcg_const_tl(0);
tcg_gen_movcond_tl(TCG_COND_NE, cpu_npc, cpu_cond, zero, npc0, npc1);
+ tcg_gen_discard_tl(cpu_cond);
tcg_temp_free(npc0);
tcg_temp_free(npc1);
@@ -5629,7 +5637,7 @@ static void disas_sparc_insn(DisasContext * dc, unsigned
int insn)
gen_op_next_insn();
} else if (dc->npc == JUMP_PC) {
/* we can do a static jump */
- gen_branch2(dc, dc->jump_pc[0], dc->jump_pc[1], cpu_cond);
+ gen_branch2(dc, dc->jump_pc[0], dc->jump_pc[1]);
dc->is_br = 1;
} else {
dc->pc = dc->npc;
--
2.7.4
- [Qemu-devel] [PATCH 03/16] target-sparc: Add MMU_PHYS_IDX, (continued)
- [Qemu-devel] [PATCH 03/16] target-sparc: Add MMU_PHYS_IDX, Richard Henderson, 2016/10/10
- [Qemu-devel] [PATCH 05/16] target-sparc: Handle more twinx asis, Richard Henderson, 2016/10/10
- [Qemu-devel] [PATCH 02/16] target-sparc: Introduce cpu_raise_exception_ra, Richard Henderson, 2016/10/10
- [Qemu-devel] [PATCH 06/16] target-sparc: Implement swap_asi inline, Richard Henderson, 2016/10/10
- [Qemu-devel] [PATCH 07/16] target-sparc: Implement ldstub_asi inline, Richard Henderson, 2016/10/10
- [Qemu-devel] [PATCH 11/16] target-sparc: Implement ldqf and stqf inline, Richard Henderson, 2016/10/10
- [Qemu-devel] [PATCH 13/16] target-sparc: Remove MMU_MODE*_SUFFIX, Richard Henderson, 2016/10/10
- [Qemu-devel] [PATCH 08/16] target-sparc: Implement cas_asi/casx_asi inline, Richard Henderson, 2016/10/10
- [Qemu-devel] [PATCH 09/16] target-sparc: Implement BCOPY/BFILL inline, Richard Henderson, 2016/10/10
- [Qemu-devel] [PATCH 12/16] target-sparc: Allow 4-byte alignment on fp mem ops, Richard Henderson, 2016/10/10
- [Qemu-devel] [PATCH 14/16] target-sparc: Optmize writeback of cpu_cond,
Richard Henderson <=
- [Qemu-devel] [PATCH 10/16] target-sparc: Remove asi helper code handled inline, Richard Henderson, 2016/10/10
- [Qemu-devel] [PATCH 15/16] target-sparc: Use tcg_gen_atomic_xchg_tl, Richard Henderson, 2016/10/10
- [Qemu-devel] [PATCH 16/16] target-sparc: Use tcg_gen_atomic_cmpxchg_tl, Richard Henderson, 2016/10/10
- Re: [Qemu-devel] [PATCH 00/16] target-sparc improvements, no-reply, 2016/10/10
- Re: [Qemu-devel] [PATCH 00/16] target-sparc improvements, Mark Cave-Ayland, 2016/10/11