[llvm] [RISCV][TTI] Add shuffle costing for masked slide lowering (PR #128537)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 24 11:46:07 PST 2025


================
@@ -413,6 +413,36 @@ bool llvm::getShuffleDemandedElts(int SrcWidth, ArrayRef<int> Mask,
   return true;
 }
 
+bool llvm::isMaskedSlidePair(ArrayRef<int> Mask, int NumElts,
+                             std::pair<int, int> SrcInfo[2]) {
+  int SignalValue = NumElts * 2;
+  SrcInfo[0] = {-1, SignalValue};
+  SrcInfo[1] = {-1, SignalValue};
+  for (unsigned i = 0; i != Mask.size(); ++i) {
+    int M = Mask[i];
+    if (M < 0)
+      continue;
+    int Src = M >= (int)NumElts;
+    int Diff = (int)i - (M % NumElts);
+    bool Match = false;
+    for (int j = 0; j < 2; j++) {
----------------
alexey-bataev wrote:

```suggestion
    for (auto &[Source, Diff] : SrcInfo) {
```

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


More information about the llvm-commits mailing list