]>
git.ipfire.org Git - thirdparty/gcc.git/commit
VECT: Apply LEN_FOLD_EXTRACT_LAST into loop vectorizer
Hi.
This patch is apply LEN_FOLD_EXTRACT_LAST into loop vectorizer.
Consider this following case:
/* Simple condition reduction. */
int __attribute__ ((noinline, noclone))
condition_reduction (int *a, int min_v)
{
int last = 66; /* High start value. */
for (int i = 0; i < N; i++)
if (a[i] < min_v)
last = i;
return last;
}
With this patch, we can generate this following IR:
_44 = .SELECT_VL (ivtmp_42, POLY_INT_CST [4, 4]);
_34 = vect_vec_iv_.5_33 + { POLY_INT_CST [4, 4], ... };
ivtmp_36 = _44 * 4;
vect__4.8_39 = .MASK_LEN_LOAD (vectp_a.6_37, 32B, { -1, ... }, _44, 0);
mask__11.9_41 = vect__4.8_39 < vect_cst__40;
last_5 = .LEN_FOLD_EXTRACT_LAST (last_14, mask__11.9_41, vect_vec_iv_.5_33, _44, 0);
...
gcc/ChangeLog:
* tree-vect-loop.cc (vectorizable_reduction): Apply
LEN_FOLD_EXTRACT_LAST.
* tree-vect-stmts.cc (vectorizable_condition): Ditto.