OSDN Git Service

PR tree-optimization/40238
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / no-scevccp-outer-4.c
1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 40
7
8 int a[N];
9
10 /* induction variable k advances through inner and outer loops.  */
11
12 __attribute__ ((noinline)) int
13 foo (int n){
14   int i,j,k=0;
15   int sum;
16
17   if (n<=0)
18     return 0;
19
20   for (i = 0; i < N; i++) {
21     sum = 0;
22     for (j = 0; j < n; j+=2) {
23       sum += k++;
24     }
25     a[i] = sum + j;
26   }
27 }
28
29 int main (void)
30 {
31   int i,j,k=0;
32   int sum;
33
34   check_vect ();
35
36   for (i=0; i<N; i++)
37     a[i] = i;
38  
39   foo (N);
40
41     /* check results:  */
42   for (i=0; i<N; i++)
43     {
44       sum = 0;
45       for (j = 0; j < N; j+=2)
46         sum += k++;
47       if (a[i] != sum + j)
48         abort();
49     }
50
51   return 0;
52 }
53
54 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED." 1 "vect" { xfail *-*-* } } } */
55 /* { dg-final { cleanup-tree-dump "vect" } } */