Imported Upstream version 4.7.3
[platform/upstream/gcc48.git] / gcc / testsuite / gcc.dg / vect / vect-nest-cycle-1.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 in[N] = {232,132,32,432,532,321,327,323,321,324,322,329,432,832,932,232};
9 float out[N];
10 float check_res[N] = {112,-4,-120,264,348,121,111,91,73,60,42,33,120,504,588,-128};
11 float a[2*N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
12
13 /* Outer-loop vectorization.  */
14
15 __attribute__ ((noinline)) void 
16 foo () 
17 {
18   int i, j;
19   float res;
20
21   for (i = 0; i < N; i++)
22     {
23       res = in[i];
24
25       for (j = 0; j < N; j++) 
26         res = res - a[i+j];
27         
28       out[i] = res;
29     }
30
31   for (i = 0; i < N; i++)  
32     if (out[i] != check_res[i])
33       abort ();
34
35 }
36
37 int main ()
38 {
39   check_vect ();
40
41   foo();
42
43   return 0;
44 }
45
46 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail vect_no_align } } } */
47 /* { dg-final { cleanup-tree-dump "vect" } } */
48