OSDN Git Service

a18d7d6a9e865327bbfba9b1eee017ca0600477e
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / no-section-anchors-vect-69.c
1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 24
7
8 struct s{
9   int m;
10   int n[N][N][N];
11 };
12
13 struct s2{
14   int m;
15   int n[N-1][N-1][N-1];
16 };
17
18 struct test1{
19   struct s a; /* array a.n is unaligned */
20   int b;
21   int c;
22   struct s e; /* array e.n is aligned */
23 };
24
25 struct test2{
26   struct s2 a; /* array a.n is unaligned */
27   int b;
28   int c;
29   struct s2 e; /* array e.n is aligned */
30 };
31
32
33 struct test1 tmp1[4];
34 struct test2 tmp2[4];
35
36 __attribute__ ((noinline))
37 int main1 ()
38 {  
39   int i,j;
40
41   /* 1. unaligned (known misalignment) */
42   for (i = 0; i < N; i++)
43     {
44       tmp1[2].a.n[1][2][i] = 5;
45     }
46
47   /* check results:  */
48   for (i = 0; i <N; i++)
49     {
50       if (tmp1[2].a.n[1][2][i] != 5)
51         abort ();
52     }
53
54   /* 2. aligned */
55   for (i = 3; i < N-1; i++)
56     {
57       tmp1[2].a.n[1][2][i] = 6;
58     }
59
60   /* check results:  */
61   for (i = 3; i < N-1; i++)
62     {
63       if (tmp1[2].a.n[1][2][i] != 6)
64         abort ();
65     }
66
67   /* 3. aligned */
68   for (i = 0; i < N; i++)
69     {
70       for (j = 0; j < N; j++)
71         {
72           tmp1[2].e.n[1][i][j] = 8;
73         }
74     }
75
76   /* check results:  */
77   for (i = 0; i < N; i++)
78     {
79       for (j = 0; j < N; j++)
80         {
81           if (tmp1[2].e.n[1][i][j] != 8)
82             abort ();
83         }
84     }
85
86   /* 4. unaligned (unknown misalignment) */
87   for (i = 0; i < N-4; i++)
88     {
89       for (j = 0; j < N-4; j++)
90         {
91           tmp2[2].e.n[1][i][j] = 8;
92         }
93     }
94
95   /* check results:  */
96   for (i = 0; i < N-4; i++)
97     {
98       for (j = 0; j < N-4; j++)
99         {
100           if (tmp2[2].e.n[1][i][j] != 8)
101             abort ();
102         }
103     }
104
105   return 0;
106 }
107
108 int main (void)
109
110   check_vect ();
111   
112   return main1 ();
113
114
115 /* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */
116 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
117 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { xfail { {! vector_alignment_reachable} || { ! vect_aligned_arrays} } } } } */
118 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { {! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */
119 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { {! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */
120 /* { dg-final { cleanup-tree-dump "vect" } } */