Imported Upstream version 4.7.3
[platform/upstream/gcc48.git] / gcc / testsuite / gcc.dg / vect / no-scevccp-outer-6.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 __attribute__ ((noinline)) int
9 foo (int * __restrict__ b, int k){
10   int i,j;
11   int sum,x;
12   int a[N];
13
14   for (i = 0; i < N; i++) {
15     sum = b[i];
16     for (j = 0; j < N; j++) {
17       sum += j;
18     }
19     a[i] = sum;
20   }
21   
22   return a[k];
23 }
24
25 int main (void)
26 {
27   int i,j;
28   int sum;
29   int b[N];
30   int a[N];
31
32   check_vect ();
33
34   for (i=0; i<N; i++)
35     b[i] = i + 2;
36
37   for (i=0; i<N; i++)
38     a[i] = foo (b,i);
39
40     /* check results:  */
41   for (i=0; i<N; i++)
42     {
43       sum = b[i];
44       for (j = 0; j < N; j++){
45         sum += j;
46       }
47       if (a[i] != sum)
48         abort();
49     }
50
51   return 0;
52 }
53
54 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED." 1 "vect" { xfail { unaligned_stack || vect_no_align } } } } */
55 /* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: detected" 1 "vect" { xfail *-*-* } } } */
56 /* { dg-final { cleanup-tree-dump "vect" } } */