diff mbox series

[1/3] targt/hppa: Fix DCOR reconstruction of carry bits

Message ID 20240325030448.52110-2-richard.henderson@linaro.org
State Superseded
Headers show
Series target/hppa: Fix DCOR, UADDCM conditions | expand

Commit Message

Richard Henderson March 25, 2024, 3:04 a.m. UTC
The carry bits for each nibble N are located in bit (N+1)*4,
so the shift by 3 was off by one.  Furthermore, the carry bit
for the most significant carry bit is indeed located in bit 64,
which is located in a different storage word.

Use a double-word shift-right to reassemble into a single word
and place them all at bit 0 of their respective nibbles.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/hppa/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Helge Deller March 25, 2024, 9:48 a.m. UTC | #1
On 3/25/24 04:04, Richard Henderson wrote:
> The carry bits for each nibble N are located in bit (N+1)*4,
> so the shift by 3 was off by one.  Furthermore, the carry bit
> for the most significant carry bit is indeed located in bit 64,
> which is located in a different storage word.
>
> Use a double-word shift-right to reassemble into a single word
> and place them all at bit 0 of their respective nibbles.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Helge Deller <deller@gmx.de>
Tested-by: Helge Deller <deller@gmx.de>

Helge

> ---
>   target/hppa/translate.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/hppa/translate.c b/target/hppa/translate.c
> index e041310207..a3f425d861 100644
> --- a/target/hppa/translate.c
> +++ b/target/hppa/translate.c
> @@ -2791,7 +2791,7 @@ static bool do_dcor(DisasContext *ctx, arg_rr_cf_d *a, bool is_i)
>       nullify_over(ctx);
>
>       tmp = tcg_temp_new_i64();
> -    tcg_gen_shri_i64(tmp, cpu_psw_cb, 3);
> +    tcg_gen_extract2_i64(tmp, cpu_psw_cb, cpu_psw_cb_msb, 4);
>       if (!is_i) {
>           tcg_gen_not_i64(tmp, tmp);
>       }
diff mbox series

Patch

diff --git a/target/hppa/translate.c b/target/hppa/translate.c
index e041310207..a3f425d861 100644
--- a/target/hppa/translate.c
+++ b/target/hppa/translate.c
@@ -2791,7 +2791,7 @@  static bool do_dcor(DisasContext *ctx, arg_rr_cf_d *a, bool is_i)
     nullify_over(ctx);
 
     tmp = tcg_temp_new_i64();
-    tcg_gen_shri_i64(tmp, cpu_psw_cb, 3);
+    tcg_gen_extract2_i64(tmp, cpu_psw_cb, cpu_psw_cb_msb, 4);
     if (!is_i) {
         tcg_gen_not_i64(tmp, tmp);
     }