OSDN Git Service

PR tree-optimization/40542
[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 __attribute__ ((noinline))
21 int main1 ()
22 {  
23   int i,j;
24   struct test1 tmp1;
25
26   /* 1. unaligned */
27   for (i = 0; i < N; i++)
28     {
29       tmp1.a.n[1][2][i] = 5;
30     }
31
32   /* check results:  */
33   for (i = 0; i <N; i++)
34     {
35       if (tmp1.a.n[1][2][i] != 5)
36         abort ();
37     }
38
39   /* 2. aligned */
40   for (i = 3; i < N-1; i++)
41     {
42       tmp1.a.n[1][2][i] = 6;
43     }
44
45   /* check results:  */
46   for (i = 3; i < N-1; i++)
47     {
48       if (tmp1.a.n[1][2][i] != 6)
49         abort ();
50     }
51
52   /* 3. aligned */
53   for (i = 0; i < N; i++)
54     {
55       tmp1.e.n[1][2][i] = 7;
56     }
57
58   /* check results:  */
59   for (i = 0; i < N; i++)
60     {
61       if (tmp1.e.n[1][2][i] != 7)
62         abort ();
63     }
64
65   /* 4. unaligned */
66   for (i = 3; i < N-3; i++)
67     {
68       tmp1.e.n[1][2][i] = 8;
69     }
70  
71   /* check results:  */
72   for (i = 3; i <N-3; i++)
73     {
74       if (tmp1.e.n[1][2][i] != 8)
75         abort ();
76     }
77
78   return 0;
79 }
80
81 int main (void)
82
83   check_vect ();
84   
85   return main1 ();
86
87
88 /* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */
89 /* { dg-final { cleanup-tree-dump "vect" } } */