[clang] [X86][bytecode] Allow SSE/AVX PBLENDVB intrinsics to be used in constexpr (PR #157100)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 7 22:09:27 PDT 2025


================
@@ -3412,6 +3412,13 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
   case Builtin::BI__builtin_elementwise_fma:
     return interp__builtin_elementwise_fma(S, OpPC, Call);
 
+  case clang::X86::BI__builtin_ia32_pblendvb128:
+  case clang::X86::BI__builtin_ia32_pblendvb256:
+    return interp__builtin_elementwise_triop(
+        S, OpPC, Call, [](const APSInt &F, const APSInt &T, const APSInt &C) {
+          return ((APInt)C).isNegative() ? T : F;
----------------
shafik wrote:

Static analysis flagged that this lambda will return by copy, I spent some time looking at the code and it was not clear to me that was intended or not. The fix would be to use tailing return type and return a const ref.  

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


More information about the cfe-commits mailing list