qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: qemu-s390x@nongnu.org,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Ilya Leoshkevich" <iii@linux.ibm.com>
Subject: [PATCH v2 08/10] target/s390x: Use ilen instead in branches
Date: Wed,  5 Jun 2024 14:57:37 -0700	[thread overview]
Message-ID: <20240605215739.4758-9-richard.henderson@linaro.org> (raw)
In-Reply-To: <20240605215739.4758-1-richard.henderson@linaro.org>

Remove the remaining uses of pc_tmp, and remove the variable.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/s390x/tcg/translate.c | 28 ++++++++--------------------
 1 file changed, 8 insertions(+), 20 deletions(-)

diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
index bce9a0aeb0..3014cbea4f 100644
--- a/target/s390x/tcg/translate.c
+++ b/target/s390x/tcg/translate.c
@@ -141,12 +141,6 @@ struct DisasContext {
     const DisasInsn *insn;
     DisasFields fields;
     uint64_t ex_value;
-    /*
-     * During translate_one(), pc_tmp is used to determine the instruction
-     * to be executed after base.pc_next - e.g. next sequential instruction
-     * or a branch target.
-     */
-    uint64_t pc_tmp;
     uint32_t ilen;
     enum cc_op cc_op;
     bool exit_to_mainloop;
@@ -344,11 +338,6 @@ static void store_freg32_i64(int reg, TCGv_i64 v)
     tcg_gen_st32_i64(v, tcg_env, freg32_offset(reg));
 }
 
-static void update_psw_addr(DisasContext *s)
-{
-    gen_psw_addr_disp(s, psw_addr, 0);
-}
-
 static void per_branch(DisasContext *s, TCGv_i64 dest)
 {
 #ifndef CONFIG_USER_ONLY
@@ -420,7 +409,7 @@ static void gen_program_exception(DisasContext *s, int code)
                    offsetof(CPUS390XState, int_pgm_ilen));
 
     /* update the psw */
-    update_psw_addr(s);
+    gen_psw_addr_disp(s, psw_addr, 0);
 
     /* Save off cc.  */
     update_cc_op(s);
@@ -1179,7 +1168,7 @@ static DisasJumpType help_branch(DisasContext *s, DisasCompare *c,
 
     /* Branch not taken.  */
     gen_psw_addr_disp(s, psw_addr, s->ilen);
-    if (use_goto_tb(s, s->pc_tmp)) {
+    if (use_goto_tb(s, s->base.pc_next + s->ilen)) {
         tcg_gen_goto_tb(1);
         tcg_gen_exit_tb(s->base.tb, 1);
         return DISAS_NORETURN;
@@ -2361,7 +2350,7 @@ static DisasJumpType op_ex(DisasContext *s, DisasOps *o)
         return DISAS_NORETURN;
     }
 
-    update_psw_addr(s);
+    gen_psw_addr_disp(s, psw_addr, 0);
     update_cc_op(s);
 
     if (r1 == 0) {
@@ -3085,7 +3074,7 @@ static DisasJumpType op_lpd(DisasContext *s, DisasOps *o)
 
     /* In a parallel context, stop the world and single step.  */
     if (tb_cflags(s->base.tb) & CF_PARALLEL) {
-        update_psw_addr(s);
+        gen_psw_addr_disp(s, psw_addr, 0);
         update_cc_op(s);
         gen_exception(EXCP_ATOMIC);
         return DISAS_NORETURN;
@@ -4379,7 +4368,7 @@ static DisasJumpType op_stura(DisasContext *s, DisasOps *o)
 
     if (s->base.tb->flags & FLAG_MASK_PER_STORE_REAL) {
         update_cc_op(s);
-        update_psw_addr(s);
+        gen_psw_addr_disp(s, psw_addr, 0);
         gen_helper_per_store_real(tcg_env, tcg_constant_i32(s->ilen));
         return DISAS_NORETURN;
     }
@@ -4611,7 +4600,7 @@ static DisasJumpType op_svc(DisasContext *s, DisasOps *o)
 {
     TCGv_i32 t;
 
-    update_psw_addr(s);
+    gen_psw_addr_disp(s, psw_addr, 0);
     update_cc_op(s);
 
     t = tcg_constant_i32(get_field(s, i1) & 0xff);
@@ -6193,7 +6182,6 @@ static const DisasInsn *extract_insn(CPUS390XState *env, DisasContext *s)
             g_assert_not_reached();
         }
     }
-    s->pc_tmp = s->base.pc_next + ilen;
     s->ilen = ilen;
 
     /* We can't actually determine the insn format until we've looked up
@@ -6413,7 +6401,7 @@ static DisasJumpType translate_one(CPUS390XState *env, DisasContext *s)
 
 out:
     /* Advance to the next instruction.  */
-    s->base.pc_next = s->pc_tmp;
+    s->base.pc_next += s->ilen;
     return ret;
 }
 
@@ -6475,7 +6463,7 @@ static void s390x_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
     case DISAS_NORETURN:
         break;
     case DISAS_TOO_MANY:
-        update_psw_addr(dc);
+        gen_psw_addr_disp(dc, psw_addr, 0);
         /* FALLTHRU */
     case DISAS_PC_UPDATED:
         /* Next TB starts off with CC_OP_DYNAMIC, so make sure the
-- 
2.34.1



  parent reply	other threads:[~2024-06-05 21:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-05 21:57 [PATCH v2 00/10] target/s390x: pc-relative translation Richard Henderson
2024-06-05 21:57 ` [PATCH v2 01/10] target/s390x: Change help_goto_direct to work on displacements Richard Henderson
2024-06-05 21:57 ` [PATCH v2 02/10] target/s390x: Introduce gen_psw_addr_disp Richard Henderson
2024-06-05 21:57 ` [PATCH v2 03/10] target/s390x: Remove pc argument to pc_to_link_into Richard Henderson
2024-06-05 21:57 ` [PATCH v2 04/10] target/s390x: Use gen_psw_addr_disp in pc_to_link_info Richard Henderson
2024-06-05 21:57 ` [PATCH v2 05/10] target/s390x: Use gen_psw_addr_disp in save_link_info Richard Henderson
2024-06-05 21:57 ` [PATCH v2 06/10] target/s390x: Use deposit " Richard Henderson
2024-09-09 23:19   ` [PATCH v2 06/10 1/4] target/s390x: Rename local variable " Philippe Mathieu-Daudé
2024-09-09 23:19   ` [PATCH v2 06/10 2/4] target/s390x: Use deposit to set psw_mask " Philippe Mathieu-Daudé
2024-09-09 23:50     ` Richard Henderson
2024-09-10  7:06       ` Philippe Mathieu-Daudé
2024-09-09 23:19   ` [PATCH v2 06/10 3/4] target/s390x: Use deposit to set ilen " Philippe Mathieu-Daudé
2024-09-09 23:52     ` Richard Henderson
2024-09-09 23:19   ` [PATCH v2 06/10 4/4] target/s390x: Use deposit to set cc_op " Philippe Mathieu-Daudé
2024-06-05 21:57 ` [PATCH v2 07/10] target/s390x: Use gen_psw_addr_disp in op_sam Richard Henderson
2024-06-05 21:57 ` Richard Henderson [this message]
2024-06-05 21:57 ` [PATCH v2 09/10] target/s390x: Assert masking of psw.addr in cpu_get_tb_cpu_state Richard Henderson
2024-06-05 21:57 ` [PATCH v2 10/10] target/s390x: Enable CF_PCREL Richard Henderson
2024-09-10 18:33   ` Pierrick Bouvier
2024-07-04 22:26 ` [PATCH v2 00/10] target/s390x: pc-relative translation Richard Henderson
2024-09-08 19:38   ` Richard Henderson

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=20240605215739.4758-9-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=iii@linux.ibm.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@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).