[PATCH] D95363: [SVELoopVectorize] Add support for scalable vectorization of loops with vector reverse

Caroline via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 25 07:22:08 PST 2021


CarolineConcatto created this revision.
Herald added subscribers: NickHung, hiraditya, kristof.beyls, tschuett.
CarolineConcatto requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch adds support of loop vectorization using the new intrinsic
 experimental.vector.reversr for scalable vector.
It maintains the original behaviour for fixed-vector using shuffle vectors.
It is possible to vectorize the following loop with experimental.vector.reverse

  #pragma clang loop vectorize_width(4, scalable)
  for (int i = N-1; i >= 0; --i)
    a[i] = b[i] + 1.0;

This patch adds generic support for scalable vector on
AArch64TTIImpl::getCastInstrCost and in
AArch64TTIImpl::getShuffleCost for SK_Reverse to prevent the auto-vectorization
to assert in BasicTTIImp when casting to FixedVector in these functions.
This patch uses `getNumCachedLanes()` introduced in [1] to compute  the last
element of the scalable vector.
[1] https://reviews.llvm.org/D95139

Depends on D95139 <https://reviews.llvm.org/D95139>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95363

Files:
  llvm/include/llvm/IR/IRBuilder.h
  llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/test/Transforms/LoopVectorize/AArch64/sve-vector-reverse.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95363.319005.patch
Type: text/x-patch
Size: 9832 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210125/e73deea6/attachment.bin>


More information about the llvm-commits mailing list