OSDN Git Service

6ea2614909512f1e53a00c5c9dd02a98586b50a5
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect-97.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 char x[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
9 char cb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
10
11 __attribute__ ((noinline))
12 int main1 ()
13 {  
14   struct {
15     char *p;
16     char *q;
17   } s;
18   int i;
19
20   /* Check that datarefs analysis can determine that the access via pointer
21      s.p is based off array x, which enables us to antialias this access from
22      the access to array cb.  */
23   s.p = x;
24   for (i = 0; i < N; i++)
25     {
26       s.p[i] = cb[i];
27     }
28
29   /* check results:  */
30   for (i = 0; i < N; i++)
31     {
32       if (s.p[i] != cb[i])
33         abort ();
34     }
35
36   /* Check that datarefs analysis can determine that the access via pointer
37      s.p is based off array x, and that the access via pointer s.q is based off
38      array cb, which enables us to antialias these two accesses.  */
39   s.q = cb;
40   for (i = 0; i < N; i++)
41     {
42       s.p[i] = s.q[i];
43     }
44
45   /* check results:  */
46   for (i = 0; i < N; i++)
47     {
48       if (s.p[i] != s.q[i])
49         abort ();
50     }
51
52   return 0;
53 }
54
55 int main (void)
56
57   check_vect ();
58   
59   return main1 ();
60
61
62
63 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
64 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
65 /* { dg-final { cleanup-tree-dump "vect" } } */