OSDN Git Service

* g++.dg/opt/nothrow1.C: Use cleanup-tree-dump.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect-31.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 t{
9   int k[N];
10   int l; 
11 };
12   
13 struct s{
14   char a;       /* aligned */
15   char b[N-1];  /* unaligned (offset 1B) */
16   char c[N];    /* aligned (offset NB) */
17   struct t d;   /* aligned (offset 2NB) */
18   struct t e;   /* unaligned (offset 2N+4N+4 B) */
19 };
20  
21 int main1 ()
22 {  
23   int i;
24   struct s tmp;
25
26   /* unaligned */
27   for (i = 0; i < N/2; i++)
28     {
29       tmp.b[i] = 5;
30     }
31
32   /* check results:  */
33   for (i = 0; i <N/2; i++)
34     {
35       if (tmp.b[i] != 5)
36         abort ();
37     }
38
39   /* aligned */
40   for (i = 0; i < N/2; i++)
41     {
42       tmp.c[i] = 6;
43     }
44
45   /* check results:  */
46   for (i = 0; i <N/2; i++)
47     {
48       if (tmp.c[i] != 6)
49         abort ();
50     }
51
52   /* aligned */
53   for (i = 0; i < N/2; i++)
54     {
55       tmp.d.k[i] = 7;
56     }
57
58   /* check results:  */
59   for (i = 0; i <N/2; i++)
60     {
61       if (tmp.d.k[i] != 7)
62         abort ();
63     }
64
65   /* unaligned */
66   for (i = 0; i < N/2; i++)
67     {
68       tmp.e.k[i] = 8;
69     }
70
71   /* check results:  */
72   for (i = 0; i <N/2; i++)
73     {
74       if (tmp.e.k[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 { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
90 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" } } */
91 /* { dg-final { cleanup-tree-dump "vect" } } */