https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122731
Bug ID: 122731
Summary: Adding __builtin_bswapg for all types that is a
multiple of 2 bytes (16 bits)
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Clang recently added __builtin_bswapg
(https://github.com/llvm/llvm-project/pull/162433) which works on all types is
a multiple of 16bits (2 bytes).
Though I think it should work on any that is a multiple of 8bits (1 byte) as
the only difference is the middle byte for the odd number of bytes stays in the
same position.
It would be useful if GCC added the same builtin. At least to begin with
supporting it for 8, 16, 32, 64, (and 128) bits.