Imported Upstream version 4.7.3
[platform/upstream/gcc48.git] / gcc / testsuite / gcc.dg / vect / fast-math-vect-reduc-8.c
1 /* { dg-do compile } */
2 /* { dg-require-effective-target vect_float } */
3
4 #include "tree-vect.h"
5
6 extern float x[128] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
7 extern float y[128] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
8 extern float z[128] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
9
10 float f (unsigned n)
11 {
12   float ret = 0.0;
13   unsigned i;
14   for (i = 0; i < n; i++)
15     {
16       float diff = x[i] - y[i];
17       ret -= diff * diff * z[i];
18     }
19   return ret;
20 }
21
22 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
23 /* { dg-final { cleanup-tree-dump "vect" } } */