[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH for-6.2 1/2] include/qemu/int128.h: introduce bswap128s
From: |
Peter Maydell |
Subject: |
Re: [PATCH for-6.2 1/2] include/qemu/int128.h: introduce bswap128s |
Date: |
Tue, 17 Aug 2021 13:15:27 +0100 |
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
[PATCH for-6.2 2/2] target/ppc: Don't swap 64-bit elements of AVR in gdbstub for user mode, matheus . ferst, 2021/08/16