[RISCV] Account for LMUL in memory op costs
authorPhilip Reames <preames@rivosinc.com>
Wed, 5 Apr 2023 14:47:24 +0000 (07:47 -0700)
committerPhilip Reames <listmail@philipreames.com>
Wed, 5 Apr 2023 14:58:56 +0000 (07:58 -0700)
commit37646a2c28fd08f7d7715fd8efc132357ffe0c34
treea76f73efb71d2081ebcc62d6a2b1f409a3559e75
parent05a2f4290e27c67b0f547b893f1dc9aaf6d40ca2
[RISCV] Account for LMUL in memory op costs

Generally, the cost of a memory op will scale with the number of vector registers accessed. Machines might exist which have a narrow memory access than vector register width, but machines with a wider memory access width than vector register width seem unlikely.

I noticed this because we were preferring wide loads + deinterleaves on examples where the cost of a short gather (actually a strided load) would be better. Touching 8 vector registers instead of doing a 4 element gather is not a good tradeoff.

Differential Revision: https://reviews.llvm.org/D147470
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
llvm/test/Analysis/CostModel/RISCV/masked_ldst.ll
llvm/test/Analysis/CostModel/RISCV/rvv-load-store.ll
llvm/test/Transforms/LoopVectorize/RISCV/interleaved-cost.ll
llvm/test/Transforms/LoopVectorize/RISCV/riscv-vector-reverse.ll
llvm/test/Transforms/LoopVectorize/RISCV/strided-accesses.ll
llvm/test/Transforms/LoopVectorize/RISCV/zvl32b.ll