qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 03/28] tcg/aarch64: Support bswap flags


From: Peter Maydell
Subject: Re: [PATCH 03/28] tcg/aarch64: Support bswap flags
Date: Mon, 21 Jun 2021 15:01:46 +0100

On Mon, 14 Jun 2021 at 09:41, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  tcg/aarch64/tcg-target.c.inc | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc
> index 27cde314a9..f72218b036 100644
> --- a/tcg/aarch64/tcg-target.c.inc
> +++ b/tcg/aarch64/tcg-target.c.inc
> @@ -2187,12 +2187,24 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
>          tcg_out_rev64(s, a0, a1);
>          break;
>      case INDEX_op_bswap32_i64:
> +        tcg_out_rev32(s, a0, a1);
> +        if (a2 & TCG_BSWAP_OS) {
> +            tcg_out_sxt(s, TCG_TYPE_I64, MO_32, a0, a0);
> +        }

Side note: it's rather confusing that tcg_out_rev32() doesn't
emit a REV32 insn (it emits REV with sf==0).

> +        break;
>      case INDEX_op_bswap32_i32:
>          tcg_out_rev32(s, a0, a1);
>          break;
>      case INDEX_op_bswap16_i64:
>      case INDEX_op_bswap16_i32:
>          tcg_out_rev16(s, a0, a1);
> +        if (a2 & TCG_BSWAP_OS) {
> +            /* Output must be sign-extended. */
> +            tcg_out_sxt(s, ext, MO_16, a0, a0);
> +        } else if ((a2 & (TCG_BSWAP_IZ | TCG_BSWAP_OZ)) == TCG_BSWAP_OZ) {
> +            /* Output must be zero-extended, but input isn't. */
> +            tcg_out_uxt(s, MO_16, a0, a0);
> +        }
>          break;

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

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]