Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / gcc.dg / vect / vect-100.c
blob17f9ce1530471f7918141484fe205033c390d7e4
1 /* { dg-require-effective-target vect_int } */
3 #include <stdlib.h>
4 #include <stdarg.h>
5 #include "tree-vect.h"
7 #define N 9
9 struct extraction
11 int a[N];
12 int b[N];
15 static int a[N] = {1,2,3,4,5,6,7,8,9};
16 static int b[N] = {2,3,4,5,6,7,8,9,0};
18 int main1 () {
19 int i;
20 struct extraction *p;
22 p = (struct extraction *) malloc (sizeof (struct extraction));
24 /* Vectorizable: alias analysis determines that p can't point to a and/or b. */
25 for (i = 0; i < N; i++)
27 p->a[i] = a[i];
28 p->b[i] = b[i];
31 /* check results: */
32 for (i = 0; i < N; i++)
34 if (p->a[i] != a[i] || p->b[i] != b[i])
35 abort();
38 return 0;
41 int main2 () {
42 int i;
43 int c[N] = {1,2,3,4,5,6,7,8,9};
44 int d[N] = {2,3,4,5,6,7,8,9,0};
45 struct extraction *p;
46 p = (struct extraction *) malloc (sizeof (struct extraction));
48 /* Vectorizable: c and d are local arrays. */
49 for (i = 0; i < N; i++)
51 p->a[i] = c[i];
52 p->b[i] = d[i];
55 /* check results: */
56 for (i = 0; i < N; i++)
58 if (p->a[i] != c[i] || p->b[i] != d[i])
59 abort();
62 return 0;
65 int main (void)
67 check_vect ();
69 main1 ();
70 main2 ();
72 return 0;
75 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */
76 /* { dg-final { cleanup-tree-dump "vect" } } */