OSDN Git Service

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