[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 11/11] target/cris: Improve JMP_INDIRECT
From: |
Richard Henderson |
Subject: |
[PATCH v2 11/11] target/cris: Improve JMP_INDIRECT |
Date: |
Sun, 20 Jun 2021 14:32:49 -0700 |
Use movcond instead of brcond to set env_pc.
Discard the btarget and btaken variables to improve
register allocation and avoid unnecessary writeback.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/cris/translate.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/target/cris/translate.c b/target/cris/translate.c
index c33324b988..3200819f32 100644
--- a/target/cris/translate.c
+++ b/target/cris/translate.c
@@ -515,17 +515,6 @@ static void t_gen_swapr(TCGv d, TCGv s)
tcg_temp_free(org_s);
}
-static void t_gen_cc_jmp(TCGv pc_true, TCGv pc_false)
-{
- TCGLabel *l1 = gen_new_label();
-
- /* Conditional jmp. */
- tcg_gen_mov_tl(env_pc, pc_false);
- tcg_gen_brcondi_tl(TCG_COND_EQ, env_btaken, 0, l1);
- tcg_gen_mov_tl(env_pc, pc_true);
- gen_set_label(l1);
-}
-
static bool use_goto_tb(DisasContext *dc, target_ulong dest)
{
return ((dest ^ dc->base.pc_first) & TARGET_PAGE_MASK) == 0;
@@ -3302,8 +3291,17 @@ static void cris_tr_tb_stop(DisasContextBase *dcbase,
CPUState *cpu)
/* fall through */
case JMP_INDIRECT:
- t_gen_cc_jmp(env_btarget, tcg_constant_tl(npc));
+ tcg_gen_movcond_tl(TCG_COND_NE, env_pc,
+ env_btaken, tcg_constant_tl(0),
+ env_btarget, tcg_constant_tl(npc));
is_jmp = DISAS_JUMP;
+
+ /*
+ * We have consumed btaken and btarget. Hint to the
+ * tcg compiler that the writeback to env may be dropped.
+ */
+ tcg_gen_discard_tl(env_btaken);
+ tcg_gen_discard_tl(env_btarget);
break;
default:
--
2.25.1
- Re: [PATCH v2 02/11] target/cris: Replace DISAS_TB_JUMP with DISAS_NORETURN, (continued)
- [PATCH v2 04/11] target/cris: Remove DISAS_SWI, Richard Henderson, 2021/06/20
- [PATCH v2 07/11] target/cris: Mark helper_raise_exception noreturn, Richard Henderson, 2021/06/20
- [PATCH v2 08/11] target/cris: Mark static arrays const, Richard Henderson, 2021/06/20
- [PATCH v2 09/11] target/cris: Move delayed branch handling to tb_stop, Richard Henderson, 2021/06/20
- [PATCH v2 06/11] target/cris: Convert to TranslatorOps, Richard Henderson, 2021/06/20
- [PATCH v2 10/11] target/cris: Use tcg_gen_lookup_and_goto_ptr, Richard Henderson, 2021/06/20
- [PATCH v2 11/11] target/cris: Improve JMP_INDIRECT,
Richard Henderson <=