OSDN Git Service

* doc/loop.texi: Document possibility not to perform disambiguation
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect-iv-6.c
1 /* { dg-require-effective-target vect_int } */
2 #include <stdio.h>
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 16
7  
8 int main1 (int X)
9 {  
10   int arr1[N+1];
11   int arr2[N+1];
12   int k = X;
13   int m, i=0;
14   
15    /* Vectorization of induction with non-constant initial condition X. 
16       Also we have here two uses of the induction-variable k as defined
17       by the loop-header phi (as opposed to the other uses of k that are
18       defined in the loop), in which case we exercise the fact that we
19       reuse the same vector def-use-cycle for both uses. 
20       Peeling to align the store is also applied.  */
21
22    do { 
23         arr2[i+1] = 2*k;
24         k = k + 2;
25         arr1[i+1] = k;
26         k = k + 4;
27         i++;
28    } while (i < N);
29
30   /* check results:  */
31   for (i = 0; i < N; i++)
32     {
33       if (arr1[i+1] != X+6*i+2
34           || arr2[i+1] != 2*(X+6*i))
35         abort ();
36     }
37
38   return 0;
39 }
40
41 int main (void)
42
43   check_vect ();
44   
45   return main1 (3);
46
47
48 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail vect_no_align } } } */
49 /* { dg-final { cleanup-tree-dump "vect" } } */