Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / gcc.dg / vect / fast-math-vect-reduc-5.c
blob74bdd262319adcbfed7ce584237d6bcadb57a65f
1 /* { dg-require-effective-target vect_float } */
3 /* need -funsafe-math-optimizations to vectorize the summation.
4 also need -ffinite-math-only to create the min/max expr. */
6 #include <stdarg.h>
7 #include "tree-vect.h"
9 #define N 16
10 #define DIFF 242
12 int main1 (float x, float max_result)
14 int i;
15 float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
16 float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
17 float diff = 2;
18 float max = x;
19 float min = 10;
21 for (i = 0; i < N; i++) {
22 diff += (b[i] - c[i]);
25 for (i = 0; i < N; i++) {
26 max = max < c[i] ? c[i] : max;
29 for (i = 0; i < N; i++) {
30 min = min > c[i] ? c[i] : min;
33 /* check results: */
34 if (diff != DIFF)
35 abort ();
36 if (max != max_result)
37 abort ();
38 if (min != 0)
39 abort ();
41 return 0;
44 int main (void)
46 check_vect ();
48 main1 (100, 100);
49 main1 (0, 15);
50 return 0;
53 /* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */
54 /* { dg-final { cleanup-tree-dump "vect" } } */