[clang] [Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - allow insertps intrinsic to be used in constexp (PR #165513)

Simon Pilgrim via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 29 07:23:33 PDT 2025


================
@@ -3412,7 +3412,8 @@ static bool interp__builtin_x86_byteshift(
 static bool interp__builtin_ia32_shuffle_generic(
     InterpState &S, CodePtr OpPC, const CallExpr *Call,
     llvm::function_ref<std::pair<unsigned, unsigned>(unsigned, unsigned)>
-        GetSourceIndex) {
+        GetSourceIndex,
+    llvm::function_ref<bool(unsigned, unsigned)> ShouldZero = nullptr) {
----------------
RKSimon wrote:

We could just adjust the GetSourceIndex signature to either be `std::tuple<unsigned, unsigned, bool>` or `std::pair<unsigned, int>` and treat negative cases as zero.

There will be other shuffles (PSHUFB in particular) that will want zero handling as well.

CC @chaitanyav 

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


More information about the cfe-commits mailing list