[PATCH] D117499: [CodeGen] Support extracting fixed-length vectors from illegal scalable vectors

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 3 07:19:35 PDT 2022


david-arm added a comment.

In D117499#3252585 <https://reviews.llvm.org/D117499#3252585>, @efriedma wrote:

> Any thoughts on lowering to the stack, vs. generating "select" operations?  If I'm not mistaken, at least for SVE, we should always be extract elements from exactly one half of the split.  Not sure how much it matters in practice, though.
>
> Do we need to special-case i1 vectors?

I had a look into using selects, but it doesn't work because when selecting between lo and hi parts you end up constructing a non-constant index for the hi part, i.e. IdxVal - LoNumElts (which is not a constant for scalable vectors). This leads to asserts because EXTRACT_SUBVECTOR is defined to only take constant indices.

I don't think we have to do anything special for i1 vectors because if the i1 type gets promoted (i.e. NEON), then we will end up down a different path where we extract individual elements from an illegal scalable vector, which is dealt with in SplitVecOp_EXTRACT_VECTOR_ELT. This is why in `@extract_v4i1_nxv32i1_16` we end up spilling the input four times - once for each EXTRACT_VECTOR_ELT. If the i1 type is legal then presumably there will also be legal loads for them too.


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

https://reviews.llvm.org/D117499



More information about the llvm-commits mailing list