[PATCH] D95139: [SVE][LoopVectorize] Add support for extracting the last lane of a scalable vector

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 26 08:20:29 PST 2021


david-arm added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/VPlan.h:102
+  enum NonConstantLanes {
+    LAST_LANE = 0xFFFFFFFF,
+    FIRST_NON_CONST_LANE = LAST_LANE,
----------------
sdesmalen wrote:
> For scalable vectors, it probably only ever makes sense to capture any of the following lanes:
> * The first N lanes from <vscale x N x <eltty>>
> * The last N lanes from <vscale x N x <eltty>>
> 
> I'm not sure if the loop-vectorizer would currently ever need more than just the first/last lane, but I could imagine for interleaving it may want to extract the second/third/fourth-last value from the vector.
> 
> Perhaps you can represent this with:
>   unsigned LaneIdx;
>   enum {
>     LK_Fixed,
>     LK_ScalableFirst,
>     LK_ScalableLast,
>   } LaneKind;
> ?
I'm happy with the idea of adding an extra member to VPInstance that contains an enum and is probably nicer than what I have now! I'm not sure if we need a LK_ScalableFirst though as this is always known at compile time to be 0 I think - perhaps we just need a LK_First and a LK_ScalableLast? Also, are suggesting that the enum describes how to use Lane, i.e.

if (StartFromFirst)
  Index = Lane
else if (StartFromLast)
  Index = NumElts - 1 - Lane?

or with LK_ScalableLast do you literally mean the last lane of the vector?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95139



More information about the llvm-commits mailing list