OSDN Git Service

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