OSDN Git Service

PR tree-optimization/25125
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect-102.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,9};
17
18 int main1 (int x, int y) {
19   int i;
20   struct extraction *p;
21   p = (struct extraction *) malloc (sizeof (struct extraction));
22
23   for (i = 0; i < N; i++)
24     {
25        p->a[i] = a[i];
26        if (x == 135)
27          abort (); /* to avoid vectorization  */
28     }
29
30   /* Not vectorizable: distance 1.  */
31   for (i = 0; i < N - 1; i++)
32     {
33        *((int *)p + x + i) = *((int *)p + x + i + 1);
34     }
35
36   /* check results: */
37   for (i = 0; i < N; i++)
38     {
39        if (p->a[i] != b[i])
40          abort();
41     }
42   return 0;
43 }
44
45 int main (void)
46
47   check_vect ();
48
49   return main1 (0, N);
50 }
51
52 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */
53 /* { dg-final { scan-tree-dump-times "possible dependence between data-refs" 1 "vect" } } */
54 /* { dg-final { cleanup-tree-dump "vect" } } */
55