[docs] Update HowToReleaseLLVM documentation.
[llvm-project.git] / libclc / amdgcn / lib / math / fmin.cl
blob35dea8bc975f7f9300d611a4a3d959fbfae65b2b
1 #include <clc/clc.h>
3 #include "../../../generic/lib/clcmacro.h"
5 _CLC_DEF _CLC_OVERLOAD float fmin(float x, float y)
7 /* fcanonicalize removes sNaNs and flushes denormals if not enabled.
8 * Otherwise fmin instruction flushes the values for comparison,
9 * but outputs original denormal */
10 x = __builtin_canonicalizef(x);
11 y = __builtin_canonicalizef(y);
12 return __builtin_fminf(x, y);
14 _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, fmin, float, float)
16 #ifdef cl_khr_fp64
18 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
20 _CLC_DEF _CLC_OVERLOAD double fmin(double x, double y)
22 x = __builtin_canonicalize(x);
23 y = __builtin_canonicalize(y);
24 return __builtin_fmin(x, y);
26 _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, fmin, double, double)
28 #endif
29 #ifdef cl_khr_fp16
31 #pragma OPENCL EXTENSION cl_khr_fp16 : enable
33 _CLC_DEF _CLC_OVERLOAD half fmin(half x, half y)
35 if (isnan(x))
36 return y;
37 if (isnan(y))
38 return x;
39 return (y < x) ? y : x;
41 _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, half, fmin, half, half)
43 #endif
45 #define __CLC_BODY <../../../generic/lib/math/fmin.inc>
46 #include <clc/math/gentype.inc>