[SVE] Add support for scalable vectorization of loops with int/fast FP reductions
commitba1e150d03cac7629111a90eea1f2d727e465983
authorKerry McLaughlin <kerry.mclaughlin@arm.com>
Tue, 16 Feb 2021 10:43:42 +0000 (16 10:43 +0000)
committerKerry McLaughlin <kerry.mclaughlin@arm.com>
Tue, 16 Feb 2021 13:50:06 +0000 (16 13:50 +0000)
treef46873c8017e4842f390776f88b3a9d263917a13
parent32389346ed83e14b7a9bd3a31a96181c6a1cdb5e
[SVE] Add support for scalable vectorization of loops with int/fast FP reductions

This patch enables scalable vectorization of loops with integer/fast reductions, e.g:

```
unsigned sum = 0;
for (int i = 0; i < n; ++i) {
  sum += a[i];
}
```

A new TTI interface, isLegalToVectorizeReduction, has been added to prevent
reductions which are not supported for scalable types from vectorizing.
If the reduction is not supported for a given scalable VF,
computeFeasibleMaxVF will fall back to using fixed-width vectorization.

Reviewed By: david-arm, fhahn, dmgreen

Differential Revision: https://reviews.llvm.org/D95245
llvm/include/llvm/Analysis/TargetTransformInfo.h
llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
llvm/lib/Analysis/TargetTransformInfo.cpp
llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/AArch64/scalable-reductions.ll [new file with mode: 0644]