[llvm] [RISCV] Model interleave2 and deinterleave2 costs with Zvzip (PR #225752)

Pengcheng Wang via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 19:50:52 PDT 2026


================
@@ -733,6 +733,54 @@ InstructionCost RISCVTTIImpl::getSlideCost(FixedVectorType *Tp,
   return FirstSlideCost + SecondSlideCost + MaskCost;
 }
 
+/// Return the type used to cost vzip.vv, whose LMUL represents the
+/// interleaved destination EMUL. Return std::nullopt if illegal.
+static std::optional<MVT> getZvzipVZIPCostVT(MVT InterleavedVT,
+                                             const RISCVSubtarget &ST,
+                                             const RISCVTargetLowering &TLI) {
+  if (!InterleavedVT.getVectorElementCount().isKnownEven())
+    return std::nullopt;
+
+  MVT CostVT = InterleavedVT;
+  if (InterleavedVT.isFixedLengthVector()) {
+    MVT SourceVT = InterleavedVT.getHalfNumVectorElementsVT();
+    CostVT = TLI.getContainerForFixedLengthVector(SourceVT)
+                 .getDoubleNumVectorElementsVT();
----------------
wangpc-pp wrote:

Is this the same as `TLI.getContainerForFixedLengthVector(InterleavedVT)`? Because we half the `InterleavedVT` and then double it.

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


More information about the llvm-commits mailing list