Re: bswap is slow on SPARC
Valery Ushakov <[email protected]> Mon, 24 Nov 2025 18:15:42 +0300
| Newsgroups | gmane.os.netbsd.ports.sparc64,gmane.os.netbsd.ports.sparc |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Nov 24, 2025 at 18:10:07 +0300, Valery Ushakov wrote: > With the suggested renaming this turns into: > > #define bswap64(x) \ > __CAST(uint64_t, __builtin_constant_p((x)) ? \ > __byte_swap_u64_constexpr(x) : __BYTE_SWAP_U64_VARIABLE(x)) VARIABLE here is actually also confusing, b/c it immediately made me think, why don't we use a little-endian ASI to read the "variable" in SparcV9. Can we actually express this with gcc builtin tests - assuming it little endian ASI actually works and provides performance win? I would naively assume it does, but cache effects or whatever might interfere... Can you try it since you are messing with v9 asm anyway? It might make it even faster :) -uwe