[PATCH] D125856: [WIP] [RISCV] Add cost model for SK_Reverse

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 19 21:57:31 PDT 2022


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp:191
+    static const CostTblEntry ShuffleTbl[] = {
+        {TTI::SK_Reverse, MVT::nxv1i64, 1},
+        {TTI::SK_Reverse, MVT::nxv2i64, 1},
----------------
Miss_Grape wrote:
> craig.topper wrote:
> > Why do we need a table to return a 1 for every legal scalable vector type? There's gotta be better ways to do that.
> > 
> > I don't believe that 1 is the correct answer for RISC-V though. It's a vid.v, a vrsub.vx, and a vrgather.vv if I remember correctly. That's at least a cost of 3 assuming an optimal implementation of vrgather.vv.
> > Why do we need a table to return a 1 for every legal scalable vector type? There's gotta be better ways to do that.
> 
> CostTableLookup 
> 
Since you're returning the same cost for every legal vector type, I think this is equivalent to:

```
if (LT.second.isScalableVector())
  return LT.first * 1
```

But I still don't believe 1 is the correct value.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125856



More information about the llvm-commits mailing list