diff options
Diffstat (limited to 'generic/lib')
-rw-r--r-- | generic/lib/SOURCES | 1 | ||||
-rw-r--r-- | generic/lib/math/fmax.cl | 8 | ||||
-rw-r--r-- | generic/lib/math/fmax.inc | 19 |
3 files changed, 28 insertions, 0 deletions
diff --git a/generic/lib/SOURCES b/generic/lib/SOURCES index 9ebf008..e44a52b 100644 --- a/generic/lib/SOURCES +++ b/generic/lib/SOURCES @@ -12,6 +12,7 @@ integer/min.cl integer/sub_sat.cl integer/sub_sat.ll integer/sub_sat_impl.ll +math/fmax.cl math/hypot.cl math/mad.cl relational/any.cl diff --git a/generic/lib/math/fmax.cl b/generic/lib/math/fmax.cl new file mode 100644 index 0000000..6f22f35 --- /dev/null +++ b/generic/lib/math/fmax.cl @@ -0,0 +1,8 @@ +#include <clc/clc.h> + +#ifdef cl_khr_fp64 +#pragma OPENCL EXTENSION cl_khr_fp64 : enable +#endif + +#define BODY <fmax.inc> +#include <clc/math/gentype.inc> diff --git a/generic/lib/math/fmax.inc b/generic/lib/math/fmax.inc new file mode 100644 index 0000000..962bed9 --- /dev/null +++ b/generic/lib/math/fmax.inc @@ -0,0 +1,19 @@ +#define __CLC_MAX_IMPL(x, y) x < y ? y : x; + +#if GENTYPE != float && GENTYPE != double + +_CLC_OVERLOAD _CLC_DEF GENTYPE __clc_fmax(GENTYPE x, GENTYPE y) { + return __CLC_MAX_IMPL(x, y) +} + +#endif + +_CLC_OVERLOAD _CLC_DEF GENTYPE fmax(GENTYPE x, double y) { + GENTYPE vec_y = (GENTYPE) (y); + return __CLC_MAX_IMPL(x, vec_y); +} + +_CLC_OVERLOAD _CLC_DEF GENTYPE fmax(GENTYPE x, float y) { + GENTYPE vec_y = (GENTYPE) (y); + return __CLC_MAX_IMPL(x, vec_y); +} |