[LLD][COFF] Emit tail merge pdata for delay load thunks on ARM64EC (#116810)
[llvm-project.git] / libclc / amdgcn / lib / math / fmax.cl
blob4407d4a87f9ea9228119f21cc8ddbaffdebba29c
1 #include <clc/clc.h>
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)
15 #ifdef cl_khr_fp64
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)
27 #endif
28 #ifdef cl_khr_fp16
30 #pragma OPENCL EXTENSION cl_khr_fp16 : enable
32 _CLC_DEF _CLC_OVERLOAD half fmax(half x, half y)
34 if (isnan(x))
35 return y;
36 if (isnan(y))
37 return x;
38 return (y < x) ? x : y;
40 _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, half, fmax, half, half)
42 #endif
44 #define __CLC_BODY <../../../generic/lib/math/fmax.inc>
45 #include <clc/math/gentype.inc>