[PATCH] D137904: [RISCV] Provide a isOneSourceVECTOR_SHUFFLE function. NFC.

Han-Kuan Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 13 20:34:08 PST 2022


HanKuanChen added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:2768
                            const RISCVSubtarget &Subtarget) {
-  if (!N1.isUndef()) {
-    // Both input must be extracts.
-    if (N0.getOpcode() != ISD::EXTRACT_SUBVECTOR ||
-        N1.getOpcode() != ISD::EXTRACT_SUBVECTOR)
-      return false;
-
-    // Extracting from the same source.
-    SDValue Src = N0.getOperand(0);
-    if (Src != N1.getOperand(0))
-      return false;
-
-    // Make sure N0 and N1 are continuous.
-    if (N0.getConstantOperandVal(1) != 0 ||
-        N1.getConstantOperandVal(1) != Mask.size())
-      return false;
-  }
+  if (!isOneSourceVECTOR_SHUFFLE(N0, N1, Mask))
+    return false;
----------------
craig.topper wrote:
> Should isVnsrlShuffle return the SDValue returned from isOneSourceVECTOR_SHUFFLE? Looks like the caller makes an assumption about how to find the source.
> Should isVnsrlShuffle return the SDValue returned from isOneSourceVECTOR_SHUFFLE? Looks like the caller makes an assumption about how to find the source.

Does that mean `isVnsrlShuffle` should be renamed to something like `getVnsrlShuffle`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137904



More information about the llvm-commits mailing list