[Bug tree-optimization/66558] Missed vectorization of loop with control flow
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66558 rsandifo at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED --- Comment #4 from rsandifo at gcc dot gnu.org --- Patch applied.
[Bug tree-optimization/66558] Missed vectorization of loop with control flow
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66558 --- Comment #3 from alahay01 at gcc dot gnu.org --- Author: alahay01 Date: Fri Nov 13 10:51:34 2015 New Revision: 230297 URL: https://gcc.gnu.org/viewcvs?rev=230297&root=gcc&view=rev Log: Optimize condition reductions where the result is an integer induction variable 2015-11-13 Alan Hayward gcc/ PR tree-optimization/66558 * tree-vect-loop.c (is_integer_induction):Add. (vectorizable_reduction): Add integer induction checks. gcc/testsuite/ PR tree-optimization/66558 * gcc.dg/vect/pr65947-1.c: Add checks. * gcc.dg/vect/pr65947-2.c: Add checks. * gcc.dg/vect/pr65947-3.c: Add checks. * gcc.dg/vect/pr65947-4.c: Add checks. * gcc.dg/vect/pr65947-5.c: Add checks. * gcc.dg/vect/pr65947-6.c: Add checks. * gcc.dg/vect/pr65947-10.c: Add checks. * gcc.dg/vect/pr65947-12.c: New test. * gcc.dg/vect/pr65947-13.c: New test. Added: trunk/gcc/testsuite/gcc.dg/vect/pr65947-12.c trunk/gcc/testsuite/gcc.dg/vect/pr65947-13.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gcc.dg/vect/pr65947-1.c trunk/gcc/testsuite/gcc.dg/vect/pr65947-10.c trunk/gcc/testsuite/gcc.dg/vect/pr65947-2.c trunk/gcc/testsuite/gcc.dg/vect/pr65947-3.c trunk/gcc/testsuite/gcc.dg/vect/pr65947-4.c trunk/gcc/testsuite/gcc.dg/vect/pr65947-5.c trunk/gcc/testsuite/gcc.dg/vect/pr65947-6.c trunk/gcc/tree-vect-loop.c trunk/gcc/tree-vectorizer.h
[Bug tree-optimization/66558] Missed vectorization of loop with control flow
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66558 --- Comment #1 from alalaw01 at gcc dot gnu.org --- Strategy could be similar to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54013 except finding the last bit rather than the first (and no jump out of the loop). That is, in the loop body: v_pred = (a[i] > threshold) for each element if (any element of v_pred set) v_save_pred = v_pred v_save_i = {i, i+1, i+2, i+3} v_last = v_save_i // or a different expression, as is assigned to 'last' and in the epilogue, last = v_last[ rightmost set element in v_save_pred ] where the rightmost set element could be done via narrow/trunc and 'bsr' (on x86), or more generally, idx = reduc_max_expr (v_save_pred ? v_save_i : 0) // any reduction will do here, as only one element will be non-zero: last = reduc_max_expr (v_save_i == idx ? v_last : 0) // or alternatively: last = v_last[ idx & (vec_num_elts - 1) ]
[Bug tree-optimization/66558] Missed vectorization of loop with control flow
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66558 --- Comment #2 from alalaw01 at gcc dot gnu.org --- This generalizes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65947, but vectorizing the predicate as a reduction is not sufficient here.