PR tree-optimization/84740
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-91.c
blob9430da3290aa0d1822075c1ffb7cab2afd195dda
1 /* { dg-do compile } */
2 /* { dg-require-effective-target vect_int } */
3 /* { dg-additional-options "--param vect-max-peeling-for-alignment=0" } */
5 #include <stdarg.h>
6 #include "tree-vect.h"
8 #define N 256
10 /* Pick a value greater than the vector length. */
11 #if VECTOR_BITS > 128
12 #define OFF (VECTOR_BITS * 5 / 32)
13 #else
14 #define OFF 20
15 #endif
17 extern int a[N + OFF];
19 /* The alignment of 'pa' is unknown.
20 Yet we do know that both the read access and write access have
21 the same alignment. Peeling to align one of the accesses will
22 align the other. */
24 __attribute__ ((noinline)) int
25 main1 (int * pa)
27 int i;
29 for (i = 0; i < N; i++)
31 pa[i] = pa[i] + 1;
34 return 0;
37 /* The alignment of 'a' is unknown.
38 Yet we do know that both the read access and write access have
39 the same alignment. Peeling to align one of the accesses will
40 align the other. */
42 __attribute__ ((noinline)) int
43 main2 ()
45 int i;
47 for (i = 0; i < N; i++)
49 a[i] = a[i] + 1;
52 return 0;
55 __attribute__ ((noinline)) int
56 main3 ()
58 int i;
60 for (i = 0; i < N; i++)
62 a[i] = a[i + OFF];
65 return 0;
68 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 3 "vect" { xfail vect_no_int_add } } } */
69 /* { dg-final { scan-tree-dump-times "accesses have the same alignment." 3 "vect" { target { { vect_aligned_arrays } && {! vect_sizes_32B_16B} } } } } */
70 /* { dg-final { scan-tree-dump-times "accesses have the same alignment." 2 "vect" { target { {! vect_aligned_arrays } && {vect_sizes_32B_16B} } } } } */
71 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" {target { {! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */