[llvm] [RISCV][CodeGen] Add initial vzip codegen support (PR #194548)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 30 07:18:09 PDT 2026


================
@@ -13027,6 +13074,19 @@ SDValue RISCVTargetLowering::lowerVECTOR_INTERLEAVE(SDValue Op,
     return DAG.getMergeValues(Loads, DL);
   }
 
+  if (Subtarget.hasStdExtZvzip() && !Op.getOperand(0).isUndef() &&
+      !Op.getOperand(1).isUndef()) {
+    MVT VT = Op->getSimpleValueType(0);
+    if (isLegalVTForZvzip(VT, Subtarget, *this)) {
+      // Freeze the sources so we can increase their use count.
+      SDValue V1 = DAG.getFreeze(Op->getOperand(0));
+      SDValue V2 = DAG.getFreeze(Op->getOperand(1));
+      SDValue Lo = lowerZvzipVZIP(V1, V2, DL, DAG, Subtarget, /*Part=*/0);
----------------
preames wrote:

Can't you do a single vzip here, produce both halfs in one go, and then extract both halves?  You're producing the full result each time, and then discarding half.  Look at e.g. what we do for the widening interleave below.  

Oddly, I'd have thought this would impact codegen, but I can't find a test where it does, so maybe I'm misreading something here?

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


More information about the llvm-commits mailing list