OSDN Git Service

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