2018-01-16 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-29.c
blob86ec2cc1ddf89af2418d9bdea48b113acfcd646a
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-add-options bind_pic_locally } */
4 #include <stdarg.h>
5 #include "tree-vect.h"
7 #define N 128
8 #define OFF 3
10 /* unaligned load. */
12 int ia[N];
13 int ib[N+OFF];
15 __attribute__ ((noinline))
16 int main1 (int off)
18 int i;
20 for (i = 0; i < N+OFF; i++)
22 ib[i] = i;
25 for (i = 0; i < N; i++)
27 ia[i] = ib[i+off];
30 /* check results: */
31 for (i = 0; i < N; i++)
33 if (ia[i] != ib[i+off])
34 abort ();
37 return 0;
40 int main (void)
42 check_vect ();
44 main1 (0); /* aligned */
45 main1 (OFF); /* unaligned */
46 return 0;
49 /* For targets that don't support misaligned loads we version for the load.
50 (The store is aligned). */
52 /* The initialization induction loop (with aligned access) is also vectorized. */
53 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
54 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { ! vect_unaligned_possible } } } } */
55 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" } } */
56 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 1 "vect" {target { vect_no_align && { ! vect_hw_misalign } } } } } */