OSDN Git Service

PR tree-optimization/40238
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect-115.c
1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 16
7
8 struct s{
9   int b[N];
10   int c[N];
11   int m;
12 };
13
14 struct t{
15   struct s strc_s;
16   int m;
17 };
18
19 struct test1{
20   struct t strc_t;
21   struct t *ptr_t;
22   int k;
23   int l;
24 };
25
26 int a[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
27
28 __attribute__ ((noinline))
29 int main1 ()
30 {
31   int i;
32   struct test1 tmp1;
33   struct t tmp2;
34
35   tmp1.ptr_t = &tmp2;
36
37   /* DR bases comparison: record and array.  */
38   for (i = 0; i < N; i++)
39     {
40       tmp1.strc_t.strc_s.b[i] = a[i];
41     }
42
43   /* Check results.  */
44   for (i = 0; i < N; i++)
45     {
46       if (tmp1.strc_t.strc_s.b[i] != a[i])
47         abort();
48     }
49
50   /* DR bases comparison: record containing ptr and array.  */
51   for (i = 0; i < N; i++)
52     {
53       tmp1.ptr_t->strc_s.c[i] = a[i];
54     }
55
56   /* Check results.  */
57   for (i = 0; i < N; i++)
58     {
59       if (tmp1.ptr_t->strc_s.c[i] != a[i])
60         abort();
61     }
62
63     
64   return 0;
65 }
66        
67 int main (void)
68 {
69   check_vect ();
70     
71   return main1 ();
72 }
73           
74 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
75 /* { dg-final { cleanup-tree-dump "vect" } } */
76   
77