From: Peter Maydell <peter.maydell@linaro.org>
To: "Matheus K. Ferst" <matheus.ferst@eldorado.org.br>
Cc: "Richard Henderson" <richard.henderson@linaro.org>,
"QEMU Developers" <qemu-devel@nongnu.org>,
"Greg Kurz" <groug@kaod.org>, qemu-ppc <qemu-ppc@nongnu.org>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"David Gibson" <david@gibson.dropbear.id.au>
Subject: Re: [PATCH for-6.2 1/2] include/qemu/int128.h: introduce bswap128s
Date: Tue, 17 Aug 2021 13:15:27 +0100 [thread overview]
Message-ID: <CAFEAcA-eOerMaWW60hwq8-QRFND5SZDoC0PRoNy-zC-wdUwW_g@mail.gmail.com> (raw)
In-Reply-To: <a0b41585-27d1-aeaf-be03-f14935c1b8c9@eldorado.org.br>
On Tue, 17 Aug 2021 at 13:09, Matheus K. Ferst
<matheus.ferst@eldorado.org.br> wrote:
>
> On 17/08/2021 06:27, Philippe Mathieu-Daudé wrote:
> > On 8/16/21 9:13 PM, matheus.ferst@eldorado.org.br wrote:
> >> From: Matheus Ferst <matheus.ferst@eldorado.org.br>
> >> -static inline Int128 bswap128(Int128 a)
> >> -{
> >> - return int128_make128(bswap64(int128_gethi(a)), bswap64(int128_getlo(a)));
> >> -}
> >
> > Personally I'd move this one to the other #ifdef side,
> > and implement here with __builtin_bswap128().
> >
>
> I saw this builtin, but I couldn't test it on my system. It seems that
> Clang doesn't implement it, and it's only available on GCC 11:
> https://godbolt.org/z/T6vhd5a38 . I think we can use it, but I'd need to
> figure how to add a test for it in the configure script.
You should be able to get away without a configure script test --
#if __has_builtin(__builtin_bswap128)
/* version with the builtin here */
#else
/* fallback */
#endif
ought to work. (Any gcc new enough to have the builtin also has
__has_builtin; clang has had __has_builtin for ages; our compiler.h
defines a fallback "always 0" __has_builtin for older compilers.)
-- PMM
next prev parent reply other threads:[~2021-08-17 12:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-16 19:13 [PATCH for-6.2 0/2] target/ppc: Fix vector registers access in gdbstub for little-endian matheus.ferst
2021-08-16 19:13 ` [PATCH for-6.2 1/2] include/qemu/int128.h: introduce bswap128s matheus.ferst
2021-08-17 9:27 ` Philippe Mathieu-Daudé
2021-08-17 12:09 ` Matheus K. Ferst
2021-08-17 12:15 ` Peter Maydell [this message]
2021-08-17 13:55 ` Matheus K. Ferst
2021-08-16 19:13 ` [PATCH for-6.2 2/2] target/ppc: Don't swap 64-bit elements of AVR in gdbstub for user mode matheus.ferst
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=CAFEAcA-eOerMaWW60hwq8-QRFND5SZDoC0PRoNy-zC-wdUwW_g@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=david@gibson.dropbear.id.au \
--cc=groug@kaod.org \
--cc=matheus.ferst@eldorado.org.br \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=richard.henderson@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).