OSDN Git Service

* gcc.dg/vect/vect-28.c: Fix test to not expect peeling on
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect-104.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 3
8
9 struct extraction
10 {
11   int a[N][N];
12   int b[N][N];
13 };
14
15 static int a[N][N] = {{1,2,3},{4,5,6},{7,8,9}};
16 static int b[N][N] = {{17,24,7},{0,2,3},{4,31,82}};
17 static int c[N][N] = {{1,2,3},{4,6,8},{8,9,9}};
18 volatile int foo;
19
20 int main1 (int x) {
21   int i,j;
22   struct extraction *p;
23   p = (struct extraction *) malloc (sizeof (struct extraction));
24
25   for (i = 0; i < N; i++)
26    {
27     for (j = 0; j < N; j++)
28      {
29        p->a[i][j] = a[i][j];
30        p->b[i][j] = b[i][j];
31        if (foo == 135)
32          abort (); /* to avoid vectorization  */
33      }
34    }
35
36   /* Not vectorizable: distance = 1.  */
37   for (i = 1; i < N; i++)
38   {
39     for (j = 0; j < N; j++)
40     {
41        *((int *)p + x + i + j) = *((int *)p + x + i + j + 1);
42     }
43   }
44
45   /* check results: */
46   for (i = 0; i < N; i++)
47    {
48     for (j = 0; j < N; j++)
49      {
50        if (p->a[i][j] != c[i][j])
51          abort();
52      }
53   }
54   return 0;
55 }
56
57 int main (void)
58
59   check_vect ();
60
61   foo = 0;
62   return main1 (N);
63 }
64
65 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */
66 /* { dg-final { scan-tree-dump-times "possible dependence between data-refs" 1 "vect" } } */
67 /* { dg-final { cleanup-tree-dump "vect" } } */
68