OSDN Git Service

2006-12-11 Diego Novillo <dnovillo@redhat.com>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect-62.c
1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 16
7
8 int main1 ()
9 {
10   int i, j;
11   int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
12   int ia[N][4][N+8];
13
14   /* Multidimensional array. Aligned. The "inner" dimensions
15      are invariant in the inner loop. Store. */
16   for (i = 0; i < N; i++)
17     {
18       for (j = 0; j < N; j++)
19         {
20            ia[i][1][j+8] = ib[i];
21         }
22     }
23
24   /* check results: */  
25   for (i = 0; i < N; i++)
26     {
27       for (j = 0; j < N; j++)
28         {
29            if (ia[i][1][j+8] != ib[i])
30               abort();
31         }
32     }
33
34   /* Multidimensional array. Aligned. The "inner" dimensions
35      are invariant in the inner loop. Vectorizable, but the
36      vectorizer detects that everything is invariant and that
37      the loop is better left untouched. (it should be optimized away). */
38   for (i = 0; i < N; i++)
39     {
40       for (j = 0; j < N; j++)
41         {
42            ia[i][1][8] = ib[i];
43         }
44     }
45
46   /* check results: */
47   for (i = 0; i < N; i++)
48     {
49       for (j = 0; j < N; j++)
50         {
51            if (ia[i][1][8] != ib[i])
52               abort();
53         }
54     }
55
56
57   return 0;
58 }
59
60 int main (void)
61
62   check_vect ();
63
64   return main1 ();
65 }
66
67 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
68 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
69 /* { dg-final { cleanup-tree-dump "vect" } } */