On Thu, Mar 20, 2025, at 23:36, Ignacio Encinas Rubio wrote: > On 19/3/25 22:49, Arnd Bergmann wrote: >> On Wed, Mar 19, 2025, at 22:37, Ignacio Encinas Rubio wrote: >>> On 19/3/25 22:12, Arnd Bergmann wrote: >> Right, I do remember when we had a discussion about this maybe >> 15 years ago when gcc didn't have the builtins on all architectures >> yet, but those versions are long gone, and we never cleaned it up. > > I just had a chance to look at this and it looks a bit more complex than > I initially thought. ___constant_swab macros are used in more places > than I expected, and {little,big}_endian.h define their own macros that > are used elsewhere, ... > > It is not clear to me how to proceed here. I could: > > 1) Just remove ___constant_swab macros and replace them with > __builtin_swap everywhere > > 2) Go a step further and evaluate removing __constant_htonl and > relatives > > Let me know what you think is the best option :) I think we can start enabling CONFIG_ARCH_USE_BUILTIN_BSWAP on all architectures and removing the custom versions from arch/*/include/uapi/asm/swab.h, which all seem to predate the compiler builtins and likely produce worse code. Arnd