Current bit manipulation builtins can be found in documentation: http://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#Other-Builtins GCC could benefit of more bit manipulation builtins, for example: - rotate bit right: __builtin_ror8(uint8_t v, int count) __builtin_ror16(uint16_t v, int count) __builtin_ror32(uint32_t v, int count) __builtin_ror64(uint64_t v, int count) - rotate bit left: __builtin_rol8(uint8_t v, int count) __builtin_rol16(uint16_t v, int count) __builtin_rol32(uint32_t v, int count) __builtin_rol64(uint64_t v, int count) - reverse bit string (bit swap): __builtin_brev8(uint8_t v, int index, int count) __builtin_brev16(uint16_t v, int index, int count) __builtin_brev32(uint32_t v, int index, int count) __builtin_brev64(uint64_t v, int index, int count)
What do the arguments of brev mean? Related to PR 50481.
(In reply to Marc Glisse from comment #1) > What do the arguments of brev mean? > Related to PR 50481. The prototype for the reverse bit string builtin was designed to be useful to reverse bits in a subset of a integer value, starting at "index" with "count" bits. The general use case is likely to reverse all bits in a variable, (uint64_t for example): uint64_t v; __builtin_brev64(v, 0, sizeof(v) * 8); But I thought it might be interesting to have a "more" general purpose builtin. Actually, the builtin arguments for reverse should probably match what's currently available on modern hardware.