[PATCH] D133829: [RISCV] Add cost model for insertelement/extractelement of vector type that should be splitted.

Jianjian Guan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 26 02:29:05 PDT 2022


jacquesguan added a comment.

In D133829#3789751 <https://reviews.llvm.org/D133829#3789751>, @reames wrote:

> Does the proposed costing match the current lowering?  I haven't looked.
>
> I would expect the lowering to be able to do the following:
>
> - For a constant index w/ fixed vectors, emit a single extract/insert into a particular split register value.
> - For a constant index w/ scalable vectors, emit a single instruction when index < minimum VLEN implied VLMAX.
> - Use a sequence of masked slidedowns to extract an arbitrary index from an arbitrary set of vector registers.  Or possibly a vcompress instead.
>
> The spill/load lowering is legal, but rather sub-optimal.

I made some mistake before. Now the legalizer will do the following action:

For constant index:

1. All fixed length vector would lower to a single extract/insert
2. For scalable vector, if we could make sure that the index is in the first splitted vector,  lower to a single extract/insert; otherwise use stack spill and load/store.

For non constant index:
All would use stack spill and load/store.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133829



More information about the llvm-commits mailing list