2008-05-30 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-iv-6.c
blobb1a0d53e7e2e49804b4b6c213810db5a80ef466f
1 /* { dg-require-effective-target vect_int } */
2 #include <stdio.h>
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 16
8 __attribute__ ((noinline)) int main1 (int X)
9 {
10 int arr1[N+1];
11 int arr2[N+1];
12 int k = X;
13 int m, i=0;
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. This peeling also aligns
21 the load (as they have the same misalignment). */
23 do {
24 arr2[i+1] = 2*k;
25 k = k + 2;
26 arr1[i+1] = k;
27 k = k + 4;
28 i++;
29 } while (i < N);
31 /* check results: */
32 for (i = 0; i < N; i++)
34 if (arr1[i+1] != X+6*i+2
35 || arr2[i+1] != 2*(X+6*i))
36 abort ();
39 return 0;
42 int main (void)
44 check_vect ();
46 return main1 (3);
49 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" {xfail vect_no_align } } } */
50 /* { dg-final { cleanup-tree-dump "vect" } } */