[clang] [CIR] Upstream CIR codegen for blend x86 builtins (PR #174236)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 5 15:47:37 PST 2026


================
@@ -1275,18 +1275,30 @@ CIRGenFunction::emitX86BuiltinExpr(unsigned builtinID, const CallExpr *expr) {
   }
   case X86::BI__builtin_ia32_pmovqd512_mask:
   case X86::BI__builtin_ia32_pmovwb512_mask:
+    cgm.errorNYI(expr->getSourceRange(),
+                 std::string("unimplemented X86 builtin call: ") +
+                     getContext().BuiltinInfo.getName(builtinID));
+    return mlir::Value{};
   case X86::BI__builtin_ia32_pblendw128:
   case X86::BI__builtin_ia32_blendpd:
   case X86::BI__builtin_ia32_blendps:
   case X86::BI__builtin_ia32_blendpd256:
   case X86::BI__builtin_ia32_blendps256:
   case X86::BI__builtin_ia32_pblendw256:
   case X86::BI__builtin_ia32_pblendd128:
-  case X86::BI__builtin_ia32_pblendd256:
-    cgm.errorNYI(expr->getSourceRange(),
-                 std::string("unimplemented X86 builtin call: ") +
-                     getContext().BuiltinInfo.getName(builtinID));
-    return mlir::Value{};
+  case X86::BI__builtin_ia32_pblendd256: {
+    uint32_t imm = getZExtIntValueFromConstOp(ops[2]);
+    unsigned numElts = cast<cir::VectorType>(ops[0].getType()).getSize();
+
+    int64_t indices[16];
----------------
andykaylor wrote:

Rather than populating an array of integers here, can you create a `SmallVector` of `mlir::Attribute` and populate it with `cir::IntAttr` created based on the value at line 1297? That avoids any concerns about overflowing the number of elements, and it saves `createVecShuffle` from having to create such a vector of attributes.

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


More information about the cfe-commits mailing list