https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108874

--- Comment #1 from ktkachov at gcc dot gnu.org ---
(In reply to ktkachov from comment #0)
> If we look at the arm testcases in gcc.target/arm/rev16.c
> typedef unsigned int __u32;
> 
> __u32
> __rev16_32_alt (__u32 x)
> {
>   return (((__u32)(x) & (__u32)0xff00ff00UL) >> 8)
>          | (((__u32)(x) & (__u32)0x00ff00ffUL) << 8);
> }
> 
> __u32
> __rev16_32 (__u32 x)
> {
>   return (((__u32)(x) & (__u32)0x00ff00ffUL) << 8)
>          | (((__u32)(x) & (__u32)0xff00ff00UL) >> 8);
> }
> 

this isn't a simple __builtin_bswap16 as that returns a uint16_t, this is sort
of a __builtin_swap16 in each of the half-words of the u32

Reply via email to