[clang] [Clang] Support generic bit counting builtins on fixed boolean vectors (PR #154203)
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 21 10:50:59 PDT 2025
================
@@ -4213,7 +4213,7 @@ such as ``unsigned __int128`` and C23 ``unsigned _BitInt(N)``.
``__builtin_clzg`` (respectively ``__builtin_ctzg``) returns the number of
leading (respectively trailing) 0 bits in the first argument. The first argument
-can be of any unsigned integer type.
+can be of any unsigned integer type or fixed boolean vector.
----------------
jhuber6 wrote:
These boolean vectors basically go back and forth between an integer and a vector of `i1` values in the IR. It would have the same behavior as if the user did `__builtin_bit_cast(uint16_t, v)` or similar. So, leading zeroes would be the ones with 'higher' bit counts, trailing would be lower, same as saying `bitfield >> n & 1` to get the `nth` bit.
https://github.com/llvm/llvm-project/pull/154203
More information about the cfe-commits
mailing list