OSDN Git Service

* doc/loop.texi: Document possibility not to perform disambiguation
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect-3.c
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-require-effective-target vect_float } */
3
4 #include <stdarg.h>
5 #include "tree-vect.h"
6
7 #define N 20
8
9 int
10 main1 ()
11 {
12   int i;
13   float a[N];
14   float e[N];
15   float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
16   float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
17   float d[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
18   int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
19   int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
20   int ia[N];
21
22   for (i = 0; i < N; i++)
23     {
24       a[i] = b[i] + c[i] + d[i];
25       e[i] = b[i] + c[i] + d[i];
26       ia[i] = ib[i] + ic[i];
27     }
28
29   /* check results:  */
30   for (i = 0; i <N; i++)
31     {
32       float fres = b[i] + c[i] + d[i];
33       int ires = ib[i] + ic[i]; 
34       if (a[i] != fres || e[i] != fres || ia[i] != ires)
35         abort ();
36     }
37
38   return 0;
39 }
40
41 int main (void)
42 {
43   check_vect ();
44
45   return main1 ();
46 }
47
48 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
49 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
50 /* { dg-final { cleanup-tree-dump "vect" } } */