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] = {17,24,7,0,2,3,4,31,82};
17 static int c[N] = {9,17,24,7,0,2,3,4,31};
18 volatile int foo;
19 
20 __attribute__ ((noinline))
main1(int x,int y)21 int main1 (int x, int y) {
22   int i;
23   struct extraction *p;
24   p = (struct extraction *) malloc (sizeof (struct extraction));
25 
26   for (i = 0; i < N; i++)
27     {
28        p->a[i] = a[i];
29        p->b[i] = b[i];
30        if (foo == 135)
31 	 abort (); /* to avoid vectorization  */
32     }
33 
34   /* Vectorizable: distance > VF.  */
35   for (i = 0; i < N; i++)
36     {
37        *((int *)p + x + i) = *((int *)p + x + i + 8);
38     }
39 
40   /* check results: */
41   for (i = 0; i < N; i++)
42     {
43        if (p->a[i] != c[i])
44          abort();
45     }
46   return 0;
47 }
48 
main(void)49 int main (void)
50 {
51   check_vect ();
52 
53   foo = 0;
54   return main1 (0, N);
55 }
56 
57 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
58 /* { dg-final { scan-tree-dump-times "dependence distance modulo vf == 0" 1 "vect" } } */
59 
60