[RISCV] Cost model for general case of single vector permute
authorPhilip Reames <preames@rivosinc.com>
Tue, 28 Mar 2023 14:23:41 +0000 (07:23 -0700)
committerPhilip Reames <listmail@philipreames.com>
Tue, 28 Mar 2023 14:34:11 +0000 (07:34 -0700)
commit64f69e453ed38e0dcf33dfbf98f8566327d4ad93
tree02735e599b77c2e52c99b56da0e351a3e6b9f6ea
parentf38aba1866ef68da64921eb0270e93880f5f704b
[RISCV] Cost model for general case of single vector permute

The cost model was not accounting for the fact that we can generate vrgather + an index expression.

Two cases to call out.
1) I did not model the difference between vrgather and vrgatherei16. The result is the constant pool cost can be slightly understated on RV32. I don't think we care, but if someone disagrees, this would be easy to add.
2) Our current codegen for i8 vectors longer than 256 (which is the limit of what this costs) has some room for improvement.

Differential Revision: https://reviews.llvm.org/D147000
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
llvm/test/Analysis/CostModel/RISCV/shuffle-interleave.ll
llvm/test/Transforms/LoopVectorize/RISCV/interleaved-accesses.ll