Imported Upstream version 4.7.3
[platform/upstream/gcc48.git] / gcc / testsuite / gcc.dg / vect / vect-72.c
1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 128
7
8 /* unaligned load.  */
9
10 char ia[N];
11 char ib[N+1];
12
13 __attribute__ ((noinline))
14 int main1 ()
15 {
16   int i;
17
18   for (i=0; i < N+1; i++)
19     {
20       ib[i] = i;
21       /* Avoid vectorization.  */
22       if (i%3 == 0)
23         ib[i] = 5;
24     }
25
26   for (i = 1; i < N+1; i++)
27     {
28       ia[i-1] = ib[i];
29     }
30
31   /* check results:  */
32   for (i = 1; i <= N; i++)
33     {
34       if (ia[i-1] != ib[i])
35         abort ();
36     }
37
38   return 0;
39 }
40
41 int main (void)
42
43   check_vect ();
44   
45   return main1 ();
46 }
47
48 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail vect_no_align } } } */
49 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail vect_no_align } } } */
50 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" } } */
51 /* { dg-final { cleanup-tree-dump "vect" } } */