OSDN Git Service

PR tree-optimization/40238
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect-30.c
1 /* { dg-require-effective-target vect_float } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 16
7
8 float b[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
9 float a[N];
10 float c[N];
11
12 __attribute__ ((noinline))
13 int main1 (int n)
14 {
15   int i=0;
16
17   /* Vectorized: unknown loop bound.  */
18   while (n--) {
19     a[i] = b[i];
20     i++;
21   }
22
23   /* check results:  */
24   for (i = 0; i < n; i++)
25     {
26       if (a[i] != b[i])
27         abort ();
28     }
29
30   return 0;
31 }
32
33 __attribute__ ((noinline))
34 int main2 (unsigned int n)
35 {
36   int i=0;
37   int nn = n;
38
39   /* Vectorized: unknown loop bound.  */
40   while (n--) {
41     c[i] = b[i];
42     i++;
43   }
44
45   /* check results:  */
46   for (i = 0; i < nn; i++)
47     {
48       if (c[i] != b[i])
49         abort ();
50     }
51
52   return 0;
53 }
54
55 int main (void)
56
57   check_vect ();
58   
59   main1 (N);
60   main2 (N);
61   return 0;
62 }
63
64 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */
65 /* { dg-final { cleanup-tree-dump "vect" } } */