OSDN Git Service

PR tree-optimization/25125
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect-37.c
1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 16
7 char x[N] __attribute__ ((__aligned__(16)));
8  
9 int main1 (char *y)
10 {  
11   struct {
12     char *p;
13     char *q;
14   } s;
15   char cb[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
16   int i;
17
18   /* Not vectorized - can't antialias the pointer s.p from the array cb.  */
19   s.p = y;
20   for (i = 0; i < N; i++)
21     {
22       s.p[i] = cb[i];
23     }
24
25   /* check results:  */
26   for (i = 0; i < N; i++)
27     {
28       if (s.p[i] != cb[i])
29         abort ();
30     }
31
32   /* Not vectorized - can't antialias the pointer s.p from the pointer s.q.  */
33   s.q = cb;
34   for (i = 0; i < N; i++)
35     {
36       s.p[i] = s.q[i];
37     }
38
39   /* check results:  */
40   for (i = 0; i < N; i++)
41     {
42       if (s.p[i] != s.q[i])
43         abort ();
44     }
45
46   return 0;
47 }
48
49 int main (void)
50
51   check_vect ();
52   
53   return main1 (x);
54
55
56 /* Currently the loops fail to vectorize due to aliasing problems.
57    If/when the aliasing problems are resolved, unalignment may
58    prevent vectorization on some targets.  */
59 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { xfail *-*-* } } } */
60 /* { dg-final { scan-tree-dump-times "can't determine dependence between" 2 "vect" } } */
61 /* { dg-final { cleanup-tree-dump "vect" } } */