[clang] [Clang] Support generic bit counting builtins on fixed boolean vectors (PR #154203)
John McCall via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 21 11:01:15 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.
----------------
rjmccall wrote:
Okay, you're saying that the vector is essentially a bitmask where element `i` is accessed with a mask of `1 << i`? That seems logical, but it definitely needs to be documented. "leading" and "trailing" normally refer to how we write Indo-Arabic numbers, which is actually the reverse of how people generally write vectors down. So `clz` is actually counting the number of zero values at the *end* of the vector.
https://github.com/llvm/llvm-project/pull/154203
More information about the cfe-commits
mailing list