[llvm] [RISCV] Recognize VLA shift pairs from shuffle masks (PR #127710)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 18 19:58:05 PST 2025


================
@@ -5651,6 +5694,74 @@ static SDValue lowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG,
     return getWideningInterleave(EvenV, OddV, DL, DAG, Subtarget);
   }
 
+  // Recognize a pattern which can handled via a pair of vslideup/vslidedown
+  // instructions (in any combination) with masking on the second instruction.
+  // Avoid matching bit rotates as slide pairs.  This is a performance
+  // heuristic, not a functional check.
+  // TODO: Generalize this slightly to allow single instruction cases, and
+  // prune the logic above which is mostly covered by this already.
+  std::pair<int, int> SrcInfo[2];
+  unsigned RotateAmt;
+  MVT RotateVT;
+  if (isMaskedSlidePair(Mask, SrcInfo) &&
+      !isLegalBitRotate(Mask, VT, Subtarget, RotateVT, RotateAmt)) {
+    SDValue Sources[2];
+    auto getSourceFor = [&](const std::pair<int, int> &Info) {
----------------
topperc wrote:

I think lamba names are supposed to be capitalized

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


More information about the llvm-commits mailing list