[PATCH 24/28] target/sh4: Improve swap.b translation

Richard Henderson posted 28 patches 3 years, 4 months ago
Maintainers: Andrzej Zaborowski <balrogg@gmail.com>, Aurelien Jarno <aurelien@aurel32.net>, Richard Henderson <richard.henderson@linaro.org>, Cornelia Huck <cohuck@redhat.com>, David Hildenbrand <david@redhat.com>, Palmer Dabbelt <palmer@dabbelt.com>, Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Huacai Chen <chenhuacai@kernel.org>, Eduardo Habkost <ehabkost@redhat.com>, Thomas Huth <thuth@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Stefan Weil <sw@weilnetz.de>, Paolo Bonzini <pbonzini@redhat.com>, Alistair Francis <Alistair.Francis@wdc.com>, Yoshinori Sato <ysato@users.sourceforge.jp>
There is a newer version of this series
[PATCH 24/28] target/sh4: Improve swap.b translation
Posted by Richard Henderson 3 years, 4 months ago
Remove TCG_BSWAP_IZ and the preceding zero-extension.

Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/sh4/translate.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/target/sh4/translate.c b/target/sh4/translate.c
index 147219759b..f45515952f 100644
--- a/target/sh4/translate.c
+++ b/target/sh4/translate.c
@@ -676,8 +676,7 @@ static void _decode_opc(DisasContext * ctx)
     case 0x6008:		/* swap.b Rm,Rn */
 	{
             TCGv low = tcg_temp_new();
-	    tcg_gen_ext16u_i32(low, REG(B7_4));
-	    tcg_gen_bswap16_i32(low, low, TCG_BSWAP_IZ | TCG_BSWAP_OZ);
+	    tcg_gen_bswap16_i32(low, REG(B7_4), 0);
             tcg_gen_deposit_i32(REG(B11_8), REG(B7_4), low, 0, 16);
 	    tcg_temp_free(low);
 	}
-- 
2.25.1


Re: [PATCH 24/28] target/sh4: Improve swap.b translation
Posted by Peter Maydell 3 years, 4 months ago
On Mon, 14 Jun 2021 at 09:54, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Remove TCG_BSWAP_IZ and the preceding zero-extension.
>
> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  target/sh4/translate.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/target/sh4/translate.c b/target/sh4/translate.c
> index 147219759b..f45515952f 100644
> --- a/target/sh4/translate.c
> +++ b/target/sh4/translate.c
> @@ -676,8 +676,7 @@ static void _decode_opc(DisasContext * ctx)
>      case 0x6008:               /* swap.b Rm,Rn */
>         {
>              TCGv low = tcg_temp_new();
> -           tcg_gen_ext16u_i32(low, REG(B7_4));
> -           tcg_gen_bswap16_i32(low, low, TCG_BSWAP_IZ | TCG_BSWAP_OZ);
> +           tcg_gen_bswap16_i32(low, REG(B7_4), 0);
>              tcg_gen_deposit_i32(REG(B11_8), REG(B7_4), low, 0, 16);
>             tcg_temp_free(low);
>         }
> --

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM