[llvm] [ConstantFolding] Add folding for [de]interleave2, insert and extract (PR #141301)

Nikolay Panchenko via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 2 10:53:08 PDT 2025


================
@@ -3872,6 +3968,26 @@ ConstantFoldStructCall(StringRef Name, Intrinsic::ID IntrinsicID,
       return nullptr;
     return ConstantStruct::get(StTy, SinResult, CosResult);
   }
+  case Intrinsic::vector_deinterleave2: {
+    auto *Vec = dyn_cast<Constant>(Operands[0]);
+    if (!Vec)
+      return nullptr;
+
+    unsigned NumElements =
+        cast<VectorType>(Vec->getType())->getElementCount().getKnownMinValue() /
----------------
npanchen wrote:

my understanding the only scalable constant is zeroinitializer, for which `getAggregateElement` has a special handling. Other constants, if they will be ever added, would probably have broadcast semantics, i.e. they can be easily supported here too.

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


More information about the llvm-commits mailing list