OSDN Git Service

2007-12-06 Zdenek Dvorak <ook@ucw.cz>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / no-section-anchors-vect-65.c
1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 16
7 #define M 4
8
9 int ib[M][M][N] = {{{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
10                     {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
11                     {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
12                     {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}},
13                    {{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
14                     {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
15                     {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
16                     {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}},
17                    {{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
18                     {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
19                     {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
20                     {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}},
21                    {{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
22                     {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
23                     {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
24                     {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}}};
25 int ia[M][M][N];
26 int ic[N];
27
28 __attribute__ ((noinline))
29 int main1 ()
30 {
31   int i, j;
32
33   /* Multidimensional array. Aligned. The "inner" dimensions
34      are invariant in the inner loop. Load and store. */
35   for (i = 0; i < M; i++)
36     {
37       for (j = 0; j < N; j++)
38         {
39            ia[i][1][j] = ib[2][i][j];
40         }
41     }
42
43   /* check results: */  
44   for (i = 0; i < M; i++)
45     {
46       for (j = 0; j < N; j++)
47         {
48            if (ia[i][1][j] != ib[2][i][j])
49               abort();
50         }
51     }
52
53   /* Multidimensional array. Aligned. The "inner" dimensions
54      are invariant in the inner loop. Load. */
55   for (i = 0; i < M; i++)
56     {
57       for (j = 0; j < N; j++)
58         {
59            ic[j] = ib[2][i][j];
60         }
61     }
62
63   /* check results: */
64   for (i = 0; i < M; i++)
65     {
66       for (j = 0; j < N; j++)
67         {
68            if (ic[j] != ib[2][i][j])
69               abort();
70         }
71     }
72
73   return 0;
74 }
75
76 int main (void)
77
78   check_vect ();
79
80   return main1 ();
81 }
82
83 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
84 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
85 /* { dg-final { cleanup-tree-dump "vect" } } */