[llvm] [RISCV] Match vcompress during shuffle lowering (PR #117748)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 27 12:31:41 PST 2024
================
@@ -5155,6 +5155,28 @@ static SDValue lowerShuffleViaVRegSplitting(ShuffleVectorSDNode *SVN,
return convertFromScalableVector(VT, Vec, DAG, Subtarget);
}
+// Matches a subset of compress masks with a contiguous prefix of output
+// elements. This could be extended to allow gaps by deciding which
+// source elements to spuriously demand.
+static bool isCompressMask(ArrayRef<int> Mask) {
+ int Last = -1;
+ bool SawUndef = false;
+ for (int i = 0; i < Mask.size(); i++) {
+ if (Mask[i] == -1) {
+ SawUndef = true;
+ continue;
+ }
+ if (SawUndef)
+ return false;
+ if (i > (unsigned)Mask[i])
----------------
topperc wrote:
Why do we need a cast to unsigned? `i` and `Mask[i]` are both `int`.
https://github.com/llvm/llvm-project/pull/117748
More information about the llvm-commits
mailing list