AaronBallman wrote: > > Do we actually want to add this? There is `__builtin_bswapg` now, which is > > strictly better than the constant width builtins. > > i leave that discussion to you :D > > seems like gcc and clang have kind of opposed opinions on this matter :D > > > Note, we don't have __builtin_bswapg and I don't think we should, one can > > only byteswap something which has number of bits divisible by CHAR_BIT. > > https://gcc.gnu.org/pipermail/gcc-patches/2026-May/716903.html > > i was planing / about to open an issue for the `__builtin_bitreverse128` and > came across this for bswap first
I think it's worth supporting this because GCC supports it and libstdc++ is using it: https://github.com/gcc-mirror/gcc/blob/bc94521ad8f375b5e964a8e79c2dccc106d3322d/libstdc%2B%2B-v3/include/std/bit#L127 (FWIW, I don't see the issue with swapping non-value representation bits; this is the same situation as any other in which bits of a non-value representation are read or written. As far as use cases go, the use cases for swapping `_BitInt` are the same as for swapping a bit-field, so things like swaps for network byte ordering, etc. I don't think it's the most important thing in the world to support, but users can do shifting and masking to avoid reading those bits after a swap happens and so it is useful IMO.) https://github.com/llvm/llvm-project/pull/198172 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
