[all-commits] [llvm/llvm-project] 2663d2: [RISCV] Adjust select shuffle cost to reflect mask...
Philip Reames via All-commits
all-commits at lists.llvm.org
Thu Jan 18 10:24:59 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2663d2cb9c9361f0b234c40a0f50c7ba0748eb26
https://github.com/llvm/llvm-project/commit/2663d2cb9c9361f0b234c40a0f50c7ba0748eb26
Author: Philip Reames <preames at rivosinc.com>
Date: 2024-01-18 (Thu, 18 Jan 2024)
Changed paths:
M llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
M llvm/test/Analysis/CostModel/RISCV/shuffle-insert_subvector.ll
M llvm/test/Analysis/CostModel/RISCV/shuffle-select.ll
Log Message:
-----------
[RISCV] Adjust select shuffle cost to reflect mask creation cost (#77963)
This is inspired by
https://github.com/llvm/llvm-project/pull/77342#pullrequestreview-1814673242,
and is split off of same with some differences in style.
A select is a vmerge.vv with the additional cost of materializing the
bitmask vector in a vreg. All masks fit within a single vector register
(e8 + m8 is the worst case), and thus our worst case cost should be
roughly 3 (2 scalar to produce the address, one vector load op). Given
most shuffles are small, and the mask will be instead produced by
LUI/ADDI + vmv.s.x or ADDI + vmv.s.x, using 2 as the default seems quite
reasonable. At worst, we're not going to be off by much.
The prior lowering scaled the cost of the bitmask with LMUL, which I
don't understand. At m1 it did use the same base cost of 2. (@lukel97
You wrote the original code here, anything I'm missing here?)
More information about the All-commits
mailing list