2009-07-17 Richard Guenther <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-29.c
blob0ad28488056a65827b6b19ab7127404b8ecec0b5
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 128
7 #define OFF 3
9 /* unaligned load. */
11 int ia[N];
12 int ib[N+OFF];
14 __attribute__ ((noinline))
15 int main1 (int off)
17 int i;
19 for (i = 0; i < N+OFF; i++)
21 ib[i] = i;
24 for (i = 0; i < N; i++)
26 ia[i] = ib[i+off];
29 /* check results: */
30 for (i = 0; i < N; i++)
32 if (ia[i] != ib[i+off])
33 abort ();
36 return 0;
39 int main (void)
41 check_vect ();
43 main1 (0); /* aligned */
44 main1 (OFF); /* unaligned */
45 return 0;
48 /* For targets that don't support misaligned loads we version for the load.
49 (The store is aligned). */
51 /* The initialization induction loop (with aligned access) is also vectorized. */
52 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
53 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail vect_no_align } } } */
54 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" } } */
55 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 1 "vect" {target vect_no_align } } } */
56 /* { dg-final { cleanup-tree-dump "vect" } } */