1 extern void abort (void);
2 double fmax (double, double);
3 float fmaxf (float, float);
4 double fmin (double, double);
5 float fminf (float, float);
7 #define isnan __builtin_isnan
8 #define isinf __builtin_isinf
10 #define NAN __builtin_nan ("")
11 #define INFINITY __builtin_inf ()
13 #define DEF_MAXMIN(TYPE,FUN)\
14 void test_##FUN (TYPE *__restrict__ r, TYPE *__restrict__ a,\
15 TYPE *__restrict__ b)\
18 for (i = 0; i < 4; i++)\
19 r[i] = FUN (a[i], b[i]);\
22 DEF_MAXMIN (float, fmaxf)
23 DEF_MAXMIN (double, fmax)
25 DEF_MAXMIN (float, fminf)
26 DEF_MAXMIN (double, fmin)
30 float a_f[4] = { 4, NAN, -3, INFINITY };
31 float b_f[4] = { 1, 7,NAN, 0 };
33 double a_d[4] = { 4, NAN, -3, INFINITY };
34 double b_d[4] = { 1, 7, NAN, 0 };
37 test_fmaxf (r_f, a_f, b_f);
38 if (r_f[0] != 4 || isnan (r_f[1]) || isnan (r_f[2]) || !isinf (r_f[3]))
41 test_fminf (r_f, a_f, b_f);
42 if (r_f[0] != 1 || isnan (r_f[1]) || isnan (r_f[2]) || isinf (r_f[3]))
45 test_fmax (r_d, a_d, b_d);
46 if (r_d[0] != 4 || isnan (r_d[1]) || isnan (r_d[2]) || !isinf (r_d[3]))
49 test_fmin (r_d, a_d, b_d);
50 if (r_d[0] != 1 || isnan (r_d[1]) || isnan (r_d[2]) || isinf (r_d[3]))