]>
git.ipfire.org Git - thirdparty/gcc.git/commit
VECT: Support floating-point in-order reduction for length loop control
Hi, Richard and Richi.
This patch support floating-point in-order reduction for loop length control.
Consider this following case:
float foo (float *__restrict a, int n)
{
float result = 1.0;
for (int i = 0; i < n; i++)
result += a[i];
return result;
}
When compile with **NO** -ffast-math on ARM SVE, we will end up with:
loop_mask = WHILE_ULT
result = MASK_FOLD_LEFT_PLUS (...loop_mask...)
For RVV, we don't use length loop control instead of mask:
So, with this patch, we expect to see:
loop_len = SELECT_VL
result = MASK_LEN_FOLD_LEFT_PLUS (...loop_len...)
gcc/ChangeLog:
* tree-vect-loop.cc (get_masked_reduction_fn): Add mask_len_fold_left_plus.
(vectorize_fold_left_reduction): Ditto.
(vectorizable_reduction): Ditto.
(vect_transform_reduction): Ditto.