OSDN Git Service

PR tree-optimization/40542
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect-outer-6.c
1 /* { dg-require-effective-target vect_float } */
2
3 #include <stdarg.h>
4 #include <signal.h>
5 #include "tree-vect.h"
6
7 #define N 64
8 #define MAX 42
9
10 float A[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
11 float B[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
12 float C[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
13 float D[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
14 extern void abort(void); 
15
16 __attribute__ ((noinline))
17 int main1 ()
18 {  
19   float s;
20
21   int i, j;
22
23   for (i = 0; i < N; i++)
24     {
25       s = 0;
26       for (j = 0; j < N; j += 4)
27         s += C[j];
28       A[i] = s;
29     }
30
31   return 0;
32 }
33
34 int main ()
35 {
36   int i,j;
37   float s;
38
39   check_vect ();
40
41   for (i = 0; i < N; i++)
42     {
43       A[i] = i;
44       B[i] = i;
45       C[i] = i;
46       D[i] = i;
47     }
48
49   main1();
50
51   /* check results:  */
52   for (i = 0; i < N; i++)
53     {
54       s = 0;
55       for (j = 0; j < N; j += 4)
56         s += C[j];
57       if (A[i] != s)
58         abort ();
59     }
60
61   return 0;
62 }
63
64 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */
65 /* { dg-final { scan-tree-dump-times "zero step in outer loop." 1 "vect" } } */
66 /* { dg-final { cleanup-tree-dump "vect" } } */