OSDN Git Service

PR middle-end/21969
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect-91.c
1 /* { dg-do compile } */
2 /* { dg-require-effective-target vect_int } */
3
4 #include <stdarg.h>
5 #include "tree-vect.h"
6
7 #define N 256
8
9 extern int a[N];
10
11 /* The alignment of 'pa' is unknown. 
12    Yet we do know that both the read access and write access have 
13    the same alignment. Peeling to align one of the accesses will 
14    align the other.
15
16    Not vectorized yet due to problems in dataref analysis that
17    are fixed in autovect-branch but not yet in mainline.  */
18
19 int
20 main1 (int * pa)
21 {
22   int i;
23
24   for (i = 0; i < N; i++)
25     {
26       pa[i] = pa[i] + 1;
27     }
28
29   return 0;
30 }
31
32 /* The alignment of 'a' is unknown. 
33    Yet we do know that both the read access and write access have 
34    the same alignment. Peeling to align one of the accesses will 
35    align the other.  */
36
37 int
38 main2 ()
39 {
40   int i;
41
42   for (i = 0; i < N; i++)
43     {
44       a[i] = a[i] + 1;
45     }
46
47   return 0;
48 }
49
50 int 
51 main3 ()
52 {
53   int i;
54
55   for (i = 0; i < N; i++)
56     {
57       a[i] = a[i+20];
58     }
59
60   return 0;
61 }
62
63 /* Currently only the loops in main2 and main3 get vectorized. After the merge 
64    of the datarefs-analysis cleanups from autovect-branch to mainline, the loop
65    in main1 will also be vectorized.  */ 
66 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */
67 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
68 /* { dg-final { scan-tree-dump-times "accesses have the same alignment." 2 "vect" } } */
69 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" } } */
70 /* { dg-final { cleanup-tree-dump "vect" } } */