OSDN Git Service

PR tree-optimization/40542
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / 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 __attribute__ ((noinline))
10 int main1 ()
11 {
12   int i, j;
13   int ib[M][M][N] = {{{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                      {{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}, 
26                       {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}, 
27                       {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
28                       {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}}};
29   int ia[M][M][N];
30   int ic[N];    
31
32   /* Multidimensional array. Aligned. The "inner" dimensions
33      are invariant in the inner loop. Load and store. */
34   for (i = 0; i < M; i++)
35     {
36       for (j = 0; j < N; j++)
37         {
38            ia[i][1][j] = ib[2][i][j];
39         }
40     }
41
42   /* check results: */  
43   for (i = 0; i < M; i++)
44     {
45       for (j = 0; j < N; j++)
46         {
47            if (ia[i][1][j] != ib[2][i][j])
48               abort();
49         }
50     }
51
52   /* Multidimensional array. Aligned. The "inner" dimensions
53      are invariant in the inner loop. Load. */
54   for (i = 0; i < M; i++)
55     {
56       for (j = 0; j < N; j++)
57         {
58            ic[j] = ib[2][i][j];
59         }
60     }
61
62   /* check results: */
63   for (i = 0; i < M; i++)
64     {
65       for (j = 0; j < N; j++)
66         {
67            if (ic[j] != ib[2][i][j])
68               abort();
69         }
70     }
71
72   return 0;
73 }
74
75 int main (void)
76
77   check_vect ();
78
79   return main1 ();
80 }
81
82 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
83 /* { dg-final { cleanup-tree-dump "vect" } } */