[PATCH] D145678: [RISCV] Model interleave and deinterleave shuffles in cost model

Luke Lau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 9 04:23:36 PST 2023


luke added inline comments.


================
Comment at: llvm/test/Analysis/CostModel/RISCV/shuffle-interleave.ll:43
+
+; TODO: getInstructionCost doesn't call getShuffleCost here because the shuffle changes length
+define {<4 x i8>, <4 x i8>} @deinterleave_2(<8 x i8> %v) {
----------------
The motivation behind this patch is to use this shuffle cost for the cost of an interleaved memory access, so the shuffles in this test case are the same as the ones generated by the loop vectorizer.

Unfortunately, because these shuffles change the length of the vector, `TargetTransformImpl.h` returns -1 in `getInstructionCost`:

```
    case Instruction::ShuffleVector: {
      auto *Shuffle = dyn_cast<ShuffleVectorInst>(U);
      // ...

      if (Shuffle->changesLength()) {
       // ...
        return CostKind == TTI::TCK_RecipThroughput ? -1 : 1;
      }
```

Which makes it difficult to test. Any ideas here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145678



More information about the llvm-commits mailing list