2017-12-05 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-peel-1.c
blobfae99ab0b08ab99953062a54193460baa7a271c0
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 128
8 int ib[N+7];
10 __attribute__ ((noinline))
11 int main1 ()
13 int i;
14 int ia[N+1];
16 /* All the accesses are misaligned. With cost model disabled, we
17 count the number of aligned accesses for each peeling option, and
18 in this case we align the two loads if possible (i.e., if
19 misaligned stores are supported). */
20 for (i = 1; i <= N; i++)
22 ia[i] = ib[i+2] + ib[i+6];
25 /* check results: */
26 for (i = 1; i <= N; i++)
28 if (ia[i] != ib[i+2] + ib[i+6])
29 abort ();
32 return 0;
35 int main (void)
37 int i;
39 check_vect ();
41 for (i = 0; i <= N+6; i++)
43 asm volatile ("" : "+r" (i));
44 ib[i] = i;
47 return main1 ();
50 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
51 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { { vect_element_align } && { vect_aligned_arrays } } xfail { ! vect_unaligned_possible } } } } */
52 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_element_align_preferred } } } */