Merged with mainline at revision 128810.
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / no-vfa-vect-depend-1.c
blobb8731a0475f3655629872b42183710a9f8dd66da
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 17
8 __attribute__ ((noinline))
9 int main1 ()
11 int i;
12 int ia[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48};
13 int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48};
14 int res[N] = {12,24,36,48,60,72,84,96,108,120,132,144,156,168,180,192,48};
16 /* Not vectorizable due to data dependence: dependence distance 1. */
17 for (i = 0; i < N - 1; i++)
19 ia[i+1] = ia[i] * 4;
22 /* check results: */
23 for (i = 0; i < N - 1; i++)
25 if (ia[i] != 0)
26 abort ();
29 /* Vectorizable. Dependence distance -1. */
30 for (i = 0; i < N - 1; i++)
32 ib[i] = ib[i+1] * 4;
35 /* check results: */
36 for (i = 0; i < N - 1; i++)
38 if (ib[i] != res[i])
39 abort ();
42 return 0;
45 int main (void)
47 check_vect();
49 return main1 ();
52 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
53 /* { dg-final { scan-tree-dump-times "dependence distance >= VF or negative" 1 "vect" } } */
54 /* { dg-final { cleanup-tree-dump "vect" } } */