re PR tree-optimization/33291 (a+=2; a+=2 not simplified to a+=4; with -O3 ...
[gcc.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=3 -fdump-tree-vect-stats" } */
3
4 #include <stdlib.h>
5
6 #define N 128
7
8 #if __LONG_MAX__ == 2147483647
9 typedef short half_word;
10 #else
11 typedef int half_word;
12 #endif
13
14 int main_1 (int n, int *p)
15 {
16 int i;
17 half_word ib[N];
18 half_word ia[N];
19 int k;
20
21 for (i = 0; i < N; i++)
22 {
23 ia[i] = n;
24 }
25
26 /* check results: */
27 for (i = 0; i < N; i++)
28 {
29 if (ia[i] != n)
30 abort ();
31 }
32
33 k = *p;
34 for (i = 0; i < N; i++)
35 {
36 ib[i] = k;
37 }
38
39 /* check results: */
40 for (i = 0; i < N; i++)
41 {
42 if (ib[i] != k)
43 abort ();
44 }
45
46 return 0;
47 }
48
49 int main (int n)
50 {
51 return main_1 (n + 2, &n);
52 }
53
54 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
55 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
56 /* { dg-final { cleanup-tree-dump "vect" } } */