1 /* { dg-require-effective-target vect_int } */
2 /* { dg-additional-options "--param vect-max-peeling-for-alignment=0" } */
3 
4 #include <stdarg.h>
5 #include "tree-vect.h"
6 
7 #define N 16
8 
9 __attribute__ ((noinline))
main1(int n,int * a)10 int main1 (int n, int *a)
11 {
12   int i, j, k;
13   int b[N];
14 
15   for (i = 0; i < n; i++)
16     {
17       for (j = 0; j < n; j++)
18         {
19 	  k = i + n;
20           a[j] = k;
21         }
22       b[i] = k;
23     }
24 
25 
26   for (j = 0; j < n; j++)
27     if (a[j] != i + n - 1)
28       abort();
29 
30   for (j = 0; j < n; j++)
31     if (b[j] != j + n)
32       abort();
33 
34   return 0;
35 }
36 
main(void)37 int main (void)
38 {
39   int a[N+1] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
40 
41   check_vect ();
42 
43   main1 (N, a+1);
44   main1 (0, a+1);
45   main1 (1, a+1);
46   main1 (2, a+1);
47   main1 (N-1, a+1);
48 
49   return 0;
50 }
51 
52 /* Fails for targets that don't vectorize PLUS (e.g alpha).  */
53 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
54 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" {target { {! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */
55