+2016-10-13 Bin Cheng <bin.cheng@arm.com>
+
+ * tree-vect-loop.c (vect_analyze_loop_2): Check and skip loop if it
+ has no enough iterations for LOOP_VINFO_PEELING_FOR_GAPS.
+
2016-10-13 Bin Cheng <bin.cheng@arm.com>
* tree-vect-loop.c (vectorizable_live_operation): Support handling
+2016-10-13 Bin Cheng <bin.cheng@arm.com>
+
+ * gcc.dg/vect/vect-98.c: Refine test case.
+ * gcc.dg/vect/vect-strided-a-u8-i8-gap2.c: Increase niters.
+ * gcc.dg/vect/vect-strided-u8-i8-gap2.c: Ditto.
+ * gcc.dg/vect/vect-strided-u8-i8-gap4.c: Ditto.
+
2016-10-13 Jakub Jelinek <jakub@redhat.com>
PR c/77946
#include <stdarg.h>
#include "tree-vect.h"
+#define M 8
#define N 4
#define DOT4( a, b ) ( a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3] )
{
int i, j;
int ib[N] = {0,3,6,9};
- int ic[N][N];
+ int ic[M][M];
- for (i = 0; i < N; i++)
+ for (i = 0; i < M; i++)
{
ic[0][i] = DOT4 (ia[i], ib);
}
/* check results: */
- for (i = 0; i < N; i++)
+ for (i = 0; i < M; i++)
{
if (ic[0][i] != DOT4 (ia[i], ib))
abort();
int main (void)
{
- int ia[N][N] = {{1,2,3,4},{2,3,5,7},{2,4,6,8},{22,43,55,77}};
+ int ia[M][N] = {{1,2,3,4},{2,3,5,7},{2,4,6,8},{22,43,55,77},
+ {13,17,19,23},{29,31,37,41},{3,7,2,1},{4,9,8,3}};
check_vect ();
return false;
}
+ /* If epilog loop is required because of data accesses with gaps,
+ one additional iteration needs to be peeled. Check if there is
+ enough iterations for vectorization. */
+ if (LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo)
+ && LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo))
+ {
+ int vf = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
+ tree scalar_niters = LOOP_VINFO_NITERSM1 (loop_vinfo);
+
+ if (wi::to_widest (scalar_niters) < vf)
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "loop has no enough iterations to support"
+ " peeling for gaps.\n");
+ return false;
+ }
+ }
+
/* Analyze cost. Decide if worth while to vectorize. */
int min_profitable_estimate, min_profitable_iters;
vect_estimate_min_profitable_iters (loop_vinfo, &min_profitable_iters,