OSDN Git Service

PR tree-optimization/35982
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / no-vfa-vect-101.c
1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdlib.h>
4 #include <stdarg.h>
5 #include "tree-vect.h"
6
7 #define N 9
8
9 struct extraction
10 {
11   int a[N];
12   int b[N];
13 };
14
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};
17
18 __attribute__ ((noinline))
19 int main1 (int x, int y) {
20   int i;
21   struct extraction *p;
22   p = (struct extraction *) malloc (sizeof (struct extraction));
23
24   /* Not vectorizable: different unknown offset.  */
25   for (i = 0; i < N; i++)
26     {
27       *((int *)p + x + i) = a[i];
28       *((int *)p + y + i) = b[i];
29     }
30
31   /* check results: */
32   for (i = 0; i < N; i++)
33     {
34        if (p->a[i] != a[i] || p->b[i] != b[i])
35          abort();
36     }
37   return 0;
38 }
39
40 int main (void)
41
42   check_vect ();
43
44   return main1 (0, N);
45 }
46
47 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */
48 /* { dg-final { scan-tree-dump-times "can't determine dependence" 1 "vect" } } */
49 /* { dg-final { cleanup-tree-dump "vect" } } */
50