OSDN Git Service

* tree-loop-linear.c (try_interchange_loops): Compare memory access
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / tree-ssa / gen-vect-25.c
1 /* { dg-do run { target vect_cmdline_needed } } */
2 /* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=4 -fdump-tree-vect-stats" } */
3 /* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=4 -fdump-tree-vect-stats -mno-sse" { target { i?86-*-* x86_64-*-* } } } */
4
5 #include <stdlib.h>
6
7 #define N 128
8
9 #if __LONG_MAX__ == 2147483647
10 typedef short half_word;
11 #else
12 typedef int half_word;
13 #endif
14
15 int main_1 (int n, int *p)
16 {
17   int i;
18   half_word ib[N];
19   half_word ia[N];
20   int k;
21
22   for (i = 0; i < N; i++)
23     {
24       ia[i] = n;
25     }
26
27   /* check results:  */
28   for (i = 0; i < N; i++)
29     {
30       if (ia[i] != n)
31         abort ();
32     }
33
34   k = *p;
35   for (i = 0; i < N; i++)
36     {
37       ib[i] = k;
38     }
39
40   /* check results:  */
41   for (i = 0; i < N; i++)
42     {
43       if (ib[i] != k)
44         abort ();
45     }
46
47   return 0;
48 }
49
50 int main (int n)
51 {
52   return main_1 (n + 2, &n);
53 }
54
55 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
56 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
57 /* { dg-final { cleanup-tree-dump "vect" } } */