All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Jani Kokkonen <Jani.Kokkonen@huawei.com>
Cc: Laurent Desnogues <laurent.desnogues@gmail.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	Claudio Fontana <claudio.fontana@huawei.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/4] tcg/aarch64: implement byte swap operations
Date: Fri, 31 May 2013 12:11:48 -0700	[thread overview]
Message-ID: <51A8F5F4.3060407@twiddle.net> (raw)
In-Reply-To: <51A8E597.4040608@huawei.com>

On 05/31/2013 11:01 AM, Jani Kokkonen wrote:
> +static inline void tcg_out_rev(TCGContext *s, int ext, TCGReg rd, TCGReg rm)
> +{
> +    /* using REV 0x5ac00800 */
> +    unsigned int base = ext ? 0xdac00c00 : 0x5ac00800;
> +    tcg_out32(s, base | rm << 5 | rd);
> +}
> +
> +static inline void tcg_out_rev16(TCGContext *s, int ext, TCGReg rd, TCGReg rm)
> +{
> +    /* using REV16 0x5ac00400 */
> +    unsigned int base = ext ? 0xdac00400 : 0x5ac00400;
> +    tcg_out32(s, base | rm << 5 | rd);
> +}
> +
> +static inline void tcg_out_rev32(TCGContext *s, TCGReg rd, TCGReg rm)
> +{
> +    /* using REV32 0xdac00800 */
> +    unsigned int base = 0xdac00800;
> +    tcg_out32(s, base | rm << 5 | rd);
> +}

You don't actually need rev32.

> * bswap32_i32/i64 t0, t1
> 
> 32 bit byte swap on a 32/64 bit value. With a 64 bit value, it assumes that
> the four high order bytes are set to zero.

The fact that the high order bytes are known to be zero means that you
can always use tcg_out_rev with ext=0.

    case INDEX_op_bswap64_i64:
        ext = 1;
        /* FALLTHRU */
    case INDEX_op_bswap32_i64:
    case INDEX_op_bswap32_i32:
        tcg_out_rev(s, ext, args[0], args[1]);
        break;
    case INDEX_op_bswap16_i64:
    case INDEX_op_bswap16_i32:
        tcg_out_rev16(s, 0, args[0], args[1]);
        break;


r~

  reply	other threads:[~2013-05-31 19:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-31 17:51 [Qemu-devel] [PATCH 0/4] ARM aarch64 TCG tlb fast lookup Jani Kokkonen
2013-05-31 17:57 ` [Qemu-devel] [PATCH 1/4] tcg/aarch64: more low level ops in preparation of tlb, lookup Jani Kokkonen
2013-05-31 19:07   ` Richard Henderson
2013-06-03  9:43     ` Claudio Fontana
2013-05-31 18:01 ` [Qemu-devel] [PATCH 2/4] tcg/aarch64: implement byte swap operations Jani Kokkonen
2013-05-31 19:11   ` Richard Henderson [this message]
2013-06-03  9:44     ` Claudio Fontana
2013-05-31 18:05 ` [Qemu-devel] [PATCH 3/4] tcg/aarch64: implement sign/zero extend operations Jani Kokkonen
2013-05-31 19:13   ` Richard Henderson
2013-06-03  9:48     ` Claudio Fontana
2013-05-31 18:07 ` [Qemu-devel] [PATCH 4/4] tcg/aarch64: implement tlb lookup fast path Jani Kokkonen
2013-05-31 20:25   ` Richard Henderson
2013-06-03 11:21     ` Jani Kokkonen
2013-06-03 15:52       ` 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=51A8F5F4.3060407@twiddle.net \
    --to=rth@twiddle.net \
    --cc=Jani.Kokkonen@huawei.com \
    --cc=claudio.fontana@huawei.com \
    --cc=laurent.desnogues@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.