PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-97-big-array.c
blob977a9d57ed4795718722c83344c2efd761e6783e
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 128
8 char x[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
9 char cb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
11 __attribute__ ((noinline))
12 int main1 ()
14 struct {
15 char *p;
16 char *q;
17 } s;
18 int i;
19 for (i = 0; i < N; i++)
21 cb[i] = i*3;
22 asm volatile ("" ::: "memory");
25 /* Check that datarefs analysis can determine that the access via pointer
26 s.p is based off array x, which enables us to antialias this access from
27 the access to array cb. */
28 s.p = x;
29 for (i = 0; i < N; i++)
31 s.p[i] = cb[i];
34 /* check results: */
35 for (i = 0; i < N; i++)
37 if (s.p[i] != cb[i])
38 abort ();
41 /* Check that datarefs analysis can determine that the access via pointer
42 s.p is based off array x, and that the access via pointer s.q is based off
43 array cb, which enables us to antialias these two accesses. */
44 s.q = cb;
45 for (i = 0; i < N; i++)
47 s.p[i] = s.q[i];
50 /* check results: */
51 for (i = 0; i < N; i++)
53 if (s.p[i] != s.q[i])
54 abort ();
57 return 0;
60 int main (void)
62 check_vect ();
64 return main1 ();
68 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
69 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */