1 /* { dg-require-effective-target vect_float } */
2 
3 #include <stdarg.h>
4 #include "tree-vect.h"
5 
6 #define N 320
7 #define M 1024
8 float in[N+M];
9 float out[N];
10 
11 /* Outer-loop vectorization.  */
12 
13 __attribute__ ((noinline)) void
foo()14 foo (){
15   int i,j;
16   float diff;
17 
18   for (i = 0; i < N; i++) {
19     diff = 0;
20     for (j = 0; j < M; j+=4) {
21       diff += in[j+i];
22     }
23     out[i]=diff;
24   }
25 }
26 
main(void)27 int main (void)
28 {
29   check_vect ();
30   int i, j;
31   float diff;
32 
33   for (i = 0; i < N; i++)
34     in[i] = i;
35 
36   foo ();
37 
38   for (i = 0; i < N; i++) {
39     diff = 0;
40     for (j = 0; j < M; j+=4) {
41       diff += in[j+i];
42     }
43     if (out[i] != diff)
44       abort ();
45   }
46 
47   return 0;
48 }
49 
50 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect"  } } */
51