qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: edgar.iglesias@gmail.com
Subject: [PATCH v2 11/11] target/cris: Improve JMP_INDIRECT
Date: Sun, 20 Jun 2021 14:32:49 -0700	[thread overview]
Message-ID: <20210620213249.1494274-12-richard.henderson@linaro.org> (raw)
In-Reply-To: <20210620213249.1494274-1-richard.henderson@linaro.org>

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



      parent reply	other threads:[~2021-06-20 21:36 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-20 21:32 [PATCH v2 00/11] target/cris: Convert to TranslatorOps Richard Henderson
2021-06-20 21:32 ` [PATCH v2 01/11] target/cris: Add DisasContextBase to DisasContext Richard Henderson
2021-06-20 21:32 ` [PATCH v2 02/11] target/cris: Replace DISAS_TB_JUMP with DISAS_NORETURN Richard Henderson
2021-06-21 20:01   ` Philippe Mathieu-Daudé
2021-06-21 23:32     ` Richard Henderson
2021-06-20 21:32 ` [PATCH v2 03/11] target/cris: Mark exceptions as DISAS_NORETURN Richard Henderson
2021-06-20 21:32 ` [PATCH v2 04/11] target/cris: Remove DISAS_SWI Richard Henderson
2021-06-20 21:32 ` [PATCH v2 05/11] target/cris: Fix use_goto_tb Richard Henderson
2021-06-20 21:32 ` [PATCH v2 06/11] target/cris: Convert to TranslatorOps Richard Henderson
2021-06-20 21:32 ` [PATCH v2 07/11] target/cris: Mark helper_raise_exception noreturn Richard Henderson
2021-06-20 21:32 ` [PATCH v2 08/11] target/cris: Mark static arrays const Richard Henderson
2021-06-21 20:04   ` Philippe Mathieu-Daudé
2021-06-20 21:32 ` [PATCH v2 09/11] target/cris: Move delayed branch handling to tb_stop Richard Henderson
2021-06-21 17:15   ` Edgar E. Iglesias
2021-06-21 17:35     ` Richard Henderson
2021-06-20 21:32 ` [PATCH v2 10/11] target/cris: Use tcg_gen_lookup_and_goto_ptr Richard Henderson
2021-06-20 21:32 ` Richard Henderson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210620213249.1494274-12-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=edgar.iglesias@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).