OSDN Git Service

PR middle-end/21969
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect-68.c
1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 32
7
8 struct s{
9   int m;
10   int n[N][N][N];
11 };
12
13 struct test1{
14   struct s a; /* array a.n is unaligned */
15   int b;
16   int c;
17   struct s e; /* array e.n is aligned */
18 };
19
20 int main1 ()
21 {  
22   int i,j;
23   struct test1 tmp1;
24
25   /* 1. unaligned */
26   for (i = 0; i < N; i++)
27     {
28       tmp1.a.n[1][2][i] = 5;
29     }
30
31   /* check results:  */
32   for (i = 0; i <N; i++)
33     {
34       if (tmp1.a.n[1][2][i] != 5)
35         abort ();
36     }
37
38   /* 2. aligned */
39   for (i = 3; i < N-1; i++)
40     {
41       tmp1.a.n[1][2][i] = 6;
42     }
43
44   /* check results:  */
45   for (i = 3; i < N-1; i++)
46     {
47       if (tmp1.a.n[1][2][i] != 6)
48         abort ();
49     }
50
51   /* 3. aligned */
52   for (i = 0; i < N; i++)
53     {
54       tmp1.e.n[1][2][i] = 7;
55     }
56
57   /* check results:  */
58   for (i = 0; i < N; i++)
59     {
60       if (tmp1.e.n[1][2][i] != 7)
61         abort ();
62     }
63
64   /* 4. unaligned */
65   for (i = 3; i < N-3; i++)
66     {
67       tmp1.e.n[1][2][i] = 8;
68     }
69  
70   /* check results:  */
71   for (i = 3; i <N-3; i++)
72     {
73       if (tmp1.e.n[1][2][i] != 8)
74         abort ();
75     }
76
77   return 0;
78 }
79
80 int main (void)
81
82   check_vect ();
83   
84   return main1 ();
85
86
87 /* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */
88 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
89 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" } } */
90 /* { dg-final { cleanup-tree-dump "vect" } } */