[PATCH] D151742: [RISCV] Use v(f)slide1down for shuffle+insert idiom

Luke Lau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 31 02:54:14 PDT 2023


luke added a comment.

Other than Craig's comments LGTM



================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:3769-3770
+  }
+  SDValue Splat = cast<BuildVectorSDNode>(V1)->getSplatValue();
+  if (!Splat)
+    return SDValue();
----------------
Out of curiosity, what happens if we remove the restriction that it must be a splat and extract out the scalar like `vslide1down v2, (extract_vector_elt v1, idx)`? 


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:3778
+    const unsigned E = Mask.size() - ((Offset > 0) ? Offset : 0);
+    for (unsigned i =  S; i != E; ++i)
+      if (Mask[i] >= 0 && (unsigned)Mask[i] != Base + i + Offset)
----------------
Nit, extra space


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:3785
+  const unsigned NumElts = VT.getVectorNumElements();
+  bool IsVSlideDown = isSlideMask(Mask, OpsSwapped ? 0 : NumElts, 1);
+  if (!IsVSlideDown &&
----------------
Nit, other places in RISCVISelLowering.cpp spell it `VSlidedown`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151742/new/

https://reviews.llvm.org/D151742



More information about the llvm-commits mailing list