2009-07-17 Richard Guenther <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-outer-4.c
blob8f53f2553b4846e5dc12ff49728c401478f48189
1 /* { dg-require-effective-target vect_float } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 40
7 #define M 128
8 float in[N+M];
9 float coeff[M];
10 float out[N];
12 /* Outer-loop vectorization. */
14 __attribute__ ((noinline)) void
15 foo (){
16 int i,j;
17 float diff;
19 for (i = 0; i < N; i++) {
20 diff = 0;
21 for (j = 0; j < M; j+=4) {
22 diff += in[j+i]*coeff[j];
24 out[i]=diff;
28 int main (void)
30 check_vect ();
31 int i, j;
32 float diff;
34 for (i = 0; i < M; i++)
35 coeff[i] = i;
36 for (i = 0; i < N+M; i++)
37 in[i] = i;
39 foo ();
41 for (i = 0; i < N; i++) {
42 diff = 0;
43 for (j = 0; j < M; j+=4) {
44 diff += in[j+i]*coeff[j];
46 if (out[i] != diff)
47 abort ();
50 return 0;
53 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */
54 /* { dg-final { scan-tree-dump-times "zero step in outer loop." 1 "vect" } } */
55 /* { dg-final { cleanup-tree-dump "vect" } } */