Merge -r 127928:132243 from trunk
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / no-scevccp-outer-4.c
blob5cf9ade116efb0ca2b8281205e5bd2682a1bb28a
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 40
8 int a[N];
10 /* induction variable k advances through inner and outer loops. */
12 __attribute__ ((noinline)) int
13 foo (int n){
14 int i,j,k=0;
15 int sum;
17 if (n<=0)
18 return 0;
20 for (i = 0; i < N; i++) {
21 sum = 0;
22 for (j = 0; j < n; j+=2) {
23 sum += k++;
25 a[i] = sum + j;
29 int main (void)
31 int i,j,k=0;
32 int sum;
34 check_vect ();
36 for (i=0; i<N; i++)
37 a[i] = i;
39 foo (N);
41 /* check results: */
42 for (i=0; i<N; i++)
44 sum = 0;
45 for (j = 0; j < N; j+=2)
46 sum += k++;
47 if (a[i] != sum + j)
48 abort();
51 return 0;
54 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED." 1 "vect" { xfail *-*-* } } } */
55 /* { dg-final { cleanup-tree-dump "vect" } } */