[clang] [Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - allow AVX/AVX512 subvector extraction intrinsics to be used in constexpr #157712 (PR #158853)

via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 9 19:32:02 PDT 2025


================
@@ -678,6 +678,30 @@ static bool interp__builtin_popcount(InterpState &S, CodePtr OpPC,
   return true;
 }
 
+static bool interp__builtin_parity(InterpState &S, CodePtr OpPC,
+                                   const InterpFrame *Frame,
+                                   const CallExpr *Call) {
+  APSInt Val = popToAPSInt(S, Call->getArg(0));
+  pushInteger(S, Val.popcount() % 2, Call->getType());
+  return true;
+}
+
+static bool interp__builtin_clrsb(InterpState &S, CodePtr OpPC,
+                                  const InterpFrame *Frame,
+                                  const CallExpr *Call) {
+  APSInt Val = popToAPSInt(S, Call->getArg(0));
+  pushInteger(S, Val.getBitWidth() - Val.getSignificantBits(), Call->getType());
+  return true;
+}
+
+static bool interp__builtin_bitreverse(InterpState &S, CodePtr OpPC,
+                                       const InterpFrame *Frame,
+                                       const CallExpr *Call) {
+  APSInt Val = popToAPSInt(S, Call->getArg(0));
+  pushInteger(S, Val.reverseBits(), Call->getType());
+  return true;
+}
----------------
SeongjaeP wrote:

Out of curiosity, when merge conflicts like this happen, what’s the usual approach that people take?
Do most contributors usually rebase onto the latest upstream, or do they start a new PR from upstream/main and cherry-pick their commits?

https://github.com/llvm/llvm-project/pull/158853


More information about the cfe-commits mailing list