HomePhabricator

[SVE] Add support for scalable vectorization of loops with int/fast FP…

Authored by kmclaughlin on Feb 16 2021, 2:43 AM.

Description

[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