2 #include
<clc
/clcmacro.h
>
4 _CLC_DEF _CLC_OVERLOAD float fmax
(float x
, float y
)
6 /* fcanonicalize removes sNaNs and flushes denormals if not enabled.
7 * Otherwise fmax instruction flushes the values for comparison
,
8 * but outputs original denormal
*/
9 x
= __builtin_canonicalizef
(x);
10 y
= __builtin_canonicalizef
(y);
11 return __builtin_fmaxf
(x, y
);
13 _CLC_BINARY_VECTORIZE
(_CLC_OVERLOAD _CLC_DEF
, float
, fmax
, float
, float
)
17 #pragma OPENCL EXTENSION cl_khr_fp64
: enable
19 _CLC_DEF _CLC_OVERLOAD double fmax
(double x
, double y
)
21 x
= __builtin_canonicalize
(x);
22 y
= __builtin_canonicalize
(y);
23 return __builtin_fmax
(x, y
);
25 _CLC_BINARY_VECTORIZE
(_CLC_OVERLOAD _CLC_DEF
, double
, fmax
, double
, double
)
30 #pragma OPENCL EXTENSION cl_khr_fp16
: enable
32 _CLC_DEF _CLC_OVERLOAD half fmax
(half x
, half y
)
38 return
(y < x
) ? x
: y
;
40 _CLC_BINARY_VECTORIZE
(_CLC_OVERLOAD _CLC_DEF
, half
, fmax
, half
, half
)
44 #define __CLC_BODY
<..
/..
/..
/generic
/lib
/math
/fmax.inc
>
45 #include
<clc
/math
/gentype.inc
>