OSDN Git Service

PR tree-optimization/40238
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / no-scevccp-outer-9b.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 __attribute__ ((noinline)) int
11 foo (int n){
12   int i,j;
13   int sum;
14
15   if (n<=0)
16     return 0;
17
18   for (i = 0; i < N; i++) {
19     sum = 0;
20     for (j = 0; j < n; j++) {
21       sum += j;
22     }
23     a[i] = sum;
24   }
25 }
26
27 int main (void)
28 {
29   int i,j;
30   int sum;
31
32   check_vect ();
33
34   for (i=0; i<N; i++)
35     a[i] = i;
36  
37   foo (N);
38
39     /* check results:  */
40   for (i=0; i<N; i++)
41     {
42       sum = 0;
43       for (j = 0; j < N; j++)
44         sum += j;
45       if (a[i] != sum)
46         abort();
47     }
48
49   return 0;
50 }
51
52 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED." 1 "vect" } } */
53 /* { dg-final { cleanup-tree-dump "vect" } } */