using uint_least64_t = __UINT_LEAST64_TYPE__;

uint_least64_t testbswap(uint_least64_t a) noexcept
{
   return __builtin_bswap64(a);
}

clang:
https://godbolt.org/z/z8GTsazf4


_Z9testbswapm:
       revb.d  $a0, $a0
       ret


GCC:

https://godbolt.org/z/PabfxP9ve

_Z9testbswapm:
       revb.4h $r4,$r4
       revh.d  $r4,$r4
       jr      $r1

It should just use revb.d for bswap, not separate them into two.

Reply via email to