Imported Upstream version 4.7.3
[platform/upstream/gcc48.git] / gcc / testsuite / gcc.dg / vect / vect-nest-cycle-2.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 out[N];
9 float check_res[N] = {880,864,848,832,816,800,784,768,752,736,720,704,688,672,656,640};
10 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};
11
12 /* Outer-loop vectorization.  */
13
14 __attribute__ ((noinline)) void 
15 foo () 
16 {
17   int i, j;
18   float res;
19
20   for (i = 0; i < N; i++)
21     {
22       res = 1000;
23
24       for (j = 0; j < N; j++) 
25         res = res - a[i+j];
26         
27       out[i] = res;
28     }
29
30   for (i = 0; i < N; i++)  
31     if (out[i] != check_res[i])
32       abort ();
33
34 }
35
36 int main ()
37 {
38   check_vect ();
39
40   foo();
41
42   return 0;
43 }
44
45 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail vect_no_align } } } */
46 /* { dg-final { cleanup-tree-dump "vect" } } */
47