[clang] [clang] constexpr built-in elementwise bitreverse function. (PR #118177)
Simon Pilgrim via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 2 05:49:10 PST 2024
================
@@ -11322,9 +11323,18 @@ bool VectorExprEvaluator::VisitCallExpr(const CallExpr *E) {
for (unsigned EltNum = 0; EltNum < SourceLen; ++EltNum) {
APSInt Elt = Source.getVectorElt(EltNum).getInt();
- ResultElements.push_back(
- APValue(APSInt(APInt(Info.Ctx.getIntWidth(DestEltTy), Elt.popcount()),
- DestEltTy->isUnsignedIntegerOrEnumerationType())));
+ switch (E->getBuiltinCallee()) {
+ case Builtin::BI__builtin_elementwise_popcount:
+ ResultElements.push_back(APValue(
+ APSInt(APInt(Info.Ctx.getIntWidth(DestEltTy), Elt.popcount()),
+ DestEltTy->isUnsignedIntegerOrEnumerationType())));
+ break;
+ case Builtin::BI__builtin_elementwise_bitreverse:
+ ResultElements.push_back(
+ APValue(APSInt(Elt.reverseBits(),
+ DestEltTy->isUnsignedIntegerOrEnumerationType())));
+ break;
----------------
RKSimon wrote:
clang-format this
https://github.com/llvm/llvm-project/pull/118177
More information about the cfe-commits
mailing list