[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 26/63] target/cris: Improve JMP_INDIRECT
From: |
Richard Henderson |
Subject: |
[PULL 26/63] target/cris: Improve JMP_INDIRECT |
Date: |
Tue, 29 Jun 2021 11:54:18 -0700 |
Use movcond instead of brcond to set env_pc.
Discard the btarget and btaken variables to improve
register allocation and avoid unnecessary writeback.
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
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 8b379522c6..1d4c78eab2 100644
--- a/target/cris/translate.c
+++ b/target/cris/translate.c
@@ -522,17 +522,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;
@@ -3321,8 +3310,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 = dc->cpustate_changed ? DISAS_UPDATE : DISAS_JUMP;
+
+ /*
+ * We have now 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
- [PULL 17/63] target/cris: Fix use_goto_tb, (continued)
- [PULL 17/63] target/cris: Fix use_goto_tb, Richard Henderson, 2021/06/29
- [PULL 29/63] tcg: Add tcg_gen_vec_add{sub}16_i32, Richard Henderson, 2021/06/29
- [PULL 22/63] target/cris: Set cpustate_changed for rfe/rfn, Richard Henderson, 2021/06/29
- [PULL 19/63] target/cris: Mark helper_raise_exception noreturn, Richard Henderson, 2021/06/29
- [PULL 15/63] target/cris: Replace DISAS_TB_JUMP with DISAS_NORETURN, Richard Henderson, 2021/06/29
- [PULL 13/63] target/cris: Add DisasContextBase to DisasContext, Richard Henderson, 2021/06/29
- [PULL 18/63] target/cris: Convert to TranslatorOps, Richard Henderson, 2021/06/29
- [PULL 11/63] target/avr: Change ctx to DisasContext* in gen_intermediate_code, Richard Henderson, 2021/06/29
- [PULL 20/63] target/cris: Mark static arrays const, Richard Henderson, 2021/06/29
- [PULL 27/63] target/cris: Remove dc->flagx_known, Richard Henderson, 2021/06/29
- [PULL 26/63] target/cris: Improve JMP_INDIRECT,
Richard Henderson <=
- [PULL 23/63] target/cris: Add DISAS_UPDATE_NEXT, Richard Henderson, 2021/06/29
- [PULL 21/63] target/cris: Fold unhandled X_FLAG changes into cpustate_changed, Richard Henderson, 2021/06/29
- [PULL 24/63] target/cris: Add DISAS_DBRANCH, Richard Henderson, 2021/06/29
- [PULL 10/63] target/avr: Add DisasContextBase to DisasContext, Richard Henderson, 2021/06/29
- [PULL 14/63] target/cris: Remove DISAS_SWI, Richard Henderson, 2021/06/29
- [PULL 30/63] tcg: Add tcg_gen_vec_add{sub}8_i32, Richard Henderson, 2021/06/29
- [PULL 25/63] target/cris: Use tcg_gen_lookup_and_goto_ptr, Richard Henderson, 2021/06/29
- [PULL 31/63] tcg: Add tcg_gen_vec_shl{shr}{sar}16i_i32, Richard Henderson, 2021/06/29
- [PULL 32/63] tcg: Add tcg_gen_vec_shl{shr}{sar}8i_i32, Richard Henderson, 2021/06/29
- [PULL 28/63] target/cris: Do not exit tb for X_FLAG changes, Richard Henderson, 2021/06/29