OSDN Git Service

2007-12-06 Zdenek Dvorak <ook@ucw.cz>
[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 __attribute__ ((noinline)) int
17 main1 (int * pa)
18 {
19   int i;
20
21   for (i = 0; i < N; i++)
22     {
23       pa[i] = pa[i] + 1;
24     }
25
26   return 0;
27 }
28
29 /* The alignment of 'a' is unknown. 
30    Yet we do know that both the read access and write access have 
31    the same alignment. Peeling to align one of the accesses will 
32    align the other.  */
33
34 __attribute__ ((noinline)) int
35 main2 ()
36 {
37   int i;
38
39   for (i = 0; i < N; i++)
40     {
41       a[i] = a[i] + 1;
42     }
43
44   return 0;
45 }
46
47 __attribute__ ((noinline)) int
48 main3 ()
49 {
50   int i;
51
52   for (i = 0; i < N; i++)
53     {
54       a[i] = a[i+20];
55     }
56
57   return 0;
58 }
59
60 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 3 "vect" { xfail vect_no_int_add } } } */
61 /* { dg-final { scan-tree-dump-times "accesses have the same alignment." 3 "vect" } } */
62 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 3 "vect" {target vector_alignment_reachable } } } */
63 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" {target {! vector_alignment_reachable} } } } */
64 /* { dg-final { cleanup-tree-dump "vect" } } */