OSDN Git Service

+ * trans-mem.c (requires_barrier): Do not instrument thread local
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect-outer-5.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 extern void abort(void); 
11
12 __attribute__ ((noinline)) 
13 int main1 ()
14 {  
15   float A[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
16   float B[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
17   float C[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
18   float D[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
19   float E[4] = {0,480,960,1440};
20   float s;
21
22   int i, j;
23
24   for (i = 0; i < N; i++)
25     {
26       A[i] = i;
27       B[i] = i;
28       C[i] = i;
29       D[i] = i;
30     }
31
32   /* Outer-loop 1: Vectorizable with respect to dependence distance. */
33   for (i = 0; i < N-20; i++)
34     {
35       s = 0;
36       for (j=0; j<N; j+=4)
37         s += C[j];
38       A[i] = A[i+20] + s;
39     }
40
41   /* check results:  */
42   for (i = 0; i < N-20; i++)
43     {
44       s = 0;
45       for (j=0; j<N; j+=4)
46         s += C[j];
47       if (A[i] != D[i+20] + s)
48         abort ();
49     }
50
51   /* Outer-loop 2: Not vectorizable because of dependence distance. */
52   for (i = 0; i < 4; i++)
53     {
54       s = 0;
55       for (j=0; j<N; j+=4)
56         s += C[j];
57       B[i+1] = B[i] + s;
58     }
59
60   /* check results:  */
61   for (i = 0; i < 4; i++)
62     {
63       if (B[i] != E[i])
64         abort ();
65     }
66
67   return 0;
68 }
69
70 int main ()
71 {
72   check_vect ();
73   return main1();
74 }
75
76 /* NOTE: We temporarily xfail the following check until versioning for
77    aliasing is fixed to avoid versioning when the dependence distance
78    is known.  */
79 /* { dg-final { scan-tree-dump-times "not vectorized: possible dependence between data-refs" 1 "vect" { xfail *-*-* } } } */
80 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */
81 /* { dg-final { scan-tree-dump "zero step in outer loop." "vect" { xfail vect_no_align } } } */
82 /* { dg-final { cleanup-tree-dump "vect" } } */