[PATCH] D90344: [POC][LoopVectorizer] Allow invariant loads/stores using masked gather/scatter for a scalable VF.

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 28 14:09:44 PDT 2020


sdesmalen created this revision.
Herald added subscribers: dexonsmith, hiraditya.
Herald added a project: LLVM.
sdesmalen requested review of this revision.

This patch is part of a proof of concept for vectorising a loop using 
scalable vectors. The patch is shared for reference and there is no
expectation for this patch to land in the current form.

For fixed-width vectors, the loopvectorizer assumes that certain operations
can be scalarized. For example, loads/stores from uniform pointers without
masking are scalarized, which is not possible for scalable vectors. For 
these, use gather/scatter instructions instead until we've found a way to
properly widen these types.

  void loop(int N, double *a, double *b) {
    #pragma clang loop vectorize_width(4, scalable)
    for (int i = 0; i < N; i++) {
      a[42] = b[i] + 1.0;   // uses llvm.masked.scatter for the store
    }   
  }


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D90344

Files:
  llvm/lib/IR/IRBuilder.cpp
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/test/Transforms/LoopVectorize/scalable-loop-invariant-store-unpredicated-body-scalar-tail.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90344.301424.patch
Type: text/x-patch
Size: 7986 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201028/65db558b/attachment.bin>


More information about the llvm-commits mailing list