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

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed May 28 10:43:09 PDT 2025


================
@@ -3872,6 +3947,22 @@ 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() /
----------------
lukel97 wrote:

Isn't this in ConstantFoldFixedVectorCall though where the result type is fixed? So the operands should never be scalable to begin with, otherwise it's an invalid type for the intrinsic

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


More information about the llvm-commits mailing list