[llvm] [RISCV][P-ext] Replace lowerBuildVectorAsRV32PNarrowingShift with shuffle lowering. (PR #209088)
Hongyu Chen via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 13 01:09:43 PDT 2026
================
@@ -6424,6 +6377,58 @@ static SDValue lowerVECTOR_SHUFFLEAsPUnzip(ShuffleVectorSDNode *SVN,
return DAG.getNode(Opc, DL, VT, V1, V2);
}
+// Match a legalized single-source deinterleave shuffle where the source
+// vector was split into two extract_subvectors of the same vector, e.g.
+// t20: v4i8 = extract_subvector t5, 0
+// t19: v4i8 = extract_subvector t5, 4
+// t21: v4i8 = vector_shuffle<0,2,4,6> t20, t19
+// and lower it to an RV32 P narrowing shift on the original source.
+static SDValue
+lowerVECTOR_SHUFFLEAsRV32PNarrowingShift(ShuffleVectorSDNode *SVN,
+ SelectionDAG &DAG) {
+ MVT VT = SVN->getSimpleValueType(0);
+ if (VT != MVT::v4i8 && VT != MVT::v2i16)
+ return SDValue();
+
+ SDValue V1 = SVN->getOperand(0);
+ SDValue V2 = SVN->getOperand(1);
+ if (V1.getOpcode() != ISD::EXTRACT_SUBVECTOR ||
+ V2.getOpcode() != ISD::EXTRACT_SUBVECTOR ||
+ V1.getOperand(0) != V2.getOperand(0))
----------------
XChy wrote:
Can we simplify the code matching `V1,V2,V1Index,V2Index` with SDPatternMatch?
https://github.com/llvm/llvm-project/pull/209088
More information about the llvm-commits
mailing list