https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111309

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
For clz/ctz/parity/popcount/clrsb/ffs, it should be quite easy to implement
them, the primary questions are, what the builtin name should be (because
__builtin_clz etc. is already taken for unsigned int argument (resp. int for
clrsb), so we want some suffix either for all type-generic _BitInt types, or
make it type-generic completely and support all integral types in there.
And second question for clz/ctz is whether we should preserve the UB behavior
for 0 argument, or define return value even for those.  For larger _BitInt it
will be implemented using loops and so will need to take 0 limbs into account
anyway, so the advantage of invoking UB on it is smaller, and for users testing
whether _BitInt(32768) is non-zero is already quite expensive if they wanted to
have well-defined result in that case.

Reply via email to