OSDN Git Service

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