PR tree-optimization/84740
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-97.c
blob734ba3b6ca36cf56d810a1ce4329f9cb1862dede
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 16
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};
11 __attribute__ ((noinline))
12 int main1 ()
14 struct {
15 char *p;
16 char *q;
17 } s;
18 int i;
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++)
26 s.p[i] = cb[i];
29 /* check results: */
30 for (i = 0; i < N; i++)
32 if (s.p[i] != cb[i])
33 abort ();
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++)
42 s.p[i] = s.q[i];
45 /* check results: */
46 for (i = 0; i < N; i++)
48 if (s.p[i] != s.q[i])
49 abort ();
52 return 0;
55 int main (void)
57 check_vect ();
59 return main1 ();
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" } } */