[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 10:40:25 PDT 2025
================
@@ -13455,6 +13455,10 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
case Builtin::BI__lzcnt16: // Microsoft variants of count leading-zeroes
case Builtin::BI__lzcnt:
case Builtin::BI__lzcnt64: {
+ // TODO: Handle boolean vectors in constexpr contexts.
+ if (E->getArg(0)->getType()->isExtVectorBoolType())
+ return false;
----------------
rjmccall wrote:
Is it okay to just return false here without indicating why? The other places nearby that return false are recursive calls, so presumably they indicate why before returning.
Also, implementing these should be really straightforward — you just call `EvaluateVector` into a temporary `APValue`, and if that succeeds, you know it'll be a vector and the elements will be simple integer `APValue`s. I think it's reasonable to just ask for it to be done in this patch.
https://github.com/llvm/llvm-project/pull/154203
More information about the cfe-commits
mailing list