[PATCH] D32530: [SVE][IR] Scalable Vector IR Type

Graham Hunter via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 18 02:54:45 PDT 2019


huntergr added a comment.

In D32530#1470784 <https://reviews.llvm.org/D32530#1470784>, @hfinkel wrote:

> In D32530#1470773 <https://reviews.llvm.org/D32530#1470773>, @greened wrote:
>
> > > We need to clarify on insertelement/extractelement. Maybe already done in some other patches, but that clarification should be part of this patch.
> > >  Is the "length of val" under the semantics "scalable * n" in <scalable n x ElemTy>, right? Or is it still n?
> >
> > I am not sure how it could be anything but `n`.  If you don't know how long the vector is, you can't correctly generate an index beyond `n`.
>
>
> But you know at runtime... there has to be a way to determine, at runtime, vscale. And the index doesn't need to be a constant. I'm not sure that we need to restrict non-constant n to only values valid for vscale == 1.


Yes; in our downstream compiler we allow inserts and extracts at arbitrary offsets in IR (though we admittedly haven't found too much use for it) using vscale (as a constant, though obtaining the Value via an intrinsic will still work) to give us the required element index.

e.g. ##(vscale * n) - 1## for the last element.

I don't think we need to support this initially, though.

The SVE ISA doesn't allow arbitrary indices for inserts or extracts, but we can generate an appropriate predicate quite easily in the backend.


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

https://reviews.llvm.org/D32530





More information about the llvm-commits mailing list