diff mbox series

[v2,06/10,3/4] target/s390x: Use deposit to set ilen in save_link_info

Message ID 20240909231910.14428-3-philmd@linaro.org
State New
Headers show
Series None | expand

Commit Message

Philippe Mathieu-Daudé Sept. 9, 2024, 11:19 p.m. UTC
From: Richard Henderson <richard.henderson@linaro.org>

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20240605215739.4758-7-richard.henderson@linaro.org>
[PMD: Split patch, part 3/4]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/s390x/tcg/translate.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Richard Henderson Sept. 9, 2024, 11:52 p.m. UTC | #1
On 9/9/24 16:19, Philippe Mathieu-Daudé wrote:
> From: Richard Henderson <richard.henderson@linaro.org>
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> Message-ID: <20240605215739.4758-7-richard.henderson@linaro.org>
> [PMD: Split patch, part 3/4]
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   target/s390x/tcg/translate.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
> index 53ec817e29..bfb7662329 100644
> --- a/target/s390x/tcg/translate.c
> +++ b/target/s390x/tcg/translate.c
> @@ -1429,17 +1429,19 @@ static void save_link_info(DisasContext *s, DisasOps *o)
>       t1 = tcg_temp_new_i64();
>       t2 = tcg_temp_new_i64();
>   
> -    tcg_gen_andi_i64(o->out, o->out, 0xffffffff00000000ull);
> -
>       /* Shift program mask into place, garbage outside of [27:24]. */
>       tcg_gen_shri_i64(t1, psw_mask, 16);
>       /* Deposit pc to replace garbage bits below program mask. */
>       gen_psw_addr_disp(s, t2, s->ilen);
>       tcg_gen_deposit_i64(o->out, t1, t2, 0, 24);
> -    tcg_gen_ori_i64(o->out, o->out, (s->ilen / 2) << 30);
>       tcg_gen_extu_i32_i64(t2, cc_op);
>       tcg_gen_shli_i64(t2, t2, 28);
>       tcg_gen_or_i64(o->out, o->out, t2);
> +
> +    /* Install ilen. */
> +    tcg_gen_ori_i64(t1, t1, (s->ilen / 2) << 30);

This is incorrect, as bits [63:28] of t1 are still garbage.

> +
> +    tcg_gen_deposit_i64(o->out, o->out, t1, 0, 32);

You've fixed the missing high bits of out, though.

r~

>   }
>   
>   static DisasJumpType op_bal(DisasContext *s, DisasOps *o)
diff mbox series

Patch

diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
index 53ec817e29..bfb7662329 100644
--- a/target/s390x/tcg/translate.c
+++ b/target/s390x/tcg/translate.c
@@ -1429,17 +1429,19 @@  static void save_link_info(DisasContext *s, DisasOps *o)
     t1 = tcg_temp_new_i64();
     t2 = tcg_temp_new_i64();
 
-    tcg_gen_andi_i64(o->out, o->out, 0xffffffff00000000ull);
-
     /* Shift program mask into place, garbage outside of [27:24]. */
     tcg_gen_shri_i64(t1, psw_mask, 16);
     /* Deposit pc to replace garbage bits below program mask. */
     gen_psw_addr_disp(s, t2, s->ilen);
     tcg_gen_deposit_i64(o->out, t1, t2, 0, 24);
-    tcg_gen_ori_i64(o->out, o->out, (s->ilen / 2) << 30);
     tcg_gen_extu_i32_i64(t2, cc_op);
     tcg_gen_shli_i64(t2, t2, 28);
     tcg_gen_or_i64(o->out, o->out, t2);
+
+    /* Install ilen. */
+    tcg_gen_ori_i64(t1, t1, (s->ilen / 2) << 30);
+
+    tcg_gen_deposit_i64(o->out, o->out, t1, 0, 32);
 }
 
 static DisasJumpType op_bal(DisasContext *s, DisasOps *o)