From dd1fbc008250f728b96dd077242dc154e8cfc847 Mon Sep 17 00:00:00 2001 From: Jeroen Ketema Date: Tue, 24 Jun 2014 09:51:01 +0000 Subject: [PATCH] Add half limits MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit These are apparently only defined in OpenCL 1.2. HALF_MAX, HALF_MIN and HALF_EPSILON are currently omitted. Clang does not seem to support the ‘h’ suffix for half float constants even with the cl_khr_fp16 extension enabled. Reviewed-by: Tom Sellard llvm-svn: 211579 --- libclc/generic/include/clc/float/definitions.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libclc/generic/include/clc/float/definitions.h b/libclc/generic/include/clc/float/definitions.h index cd65324..6d532a5 100644 --- a/libclc/generic/include/clc/float/definitions.h +++ b/libclc/generic/include/clc/float/definitions.h @@ -46,3 +46,18 @@ #define M_PI 0x1.921fb54442d18p+1 #endif + +#ifdef cl_khr_fp16 + +#if __OPENCL_VERSION__ >= CL_VERSION_1_2 + +#define HALF_DIG 3 +#define HALF_MANT_DIG 11 +#define HALF_MAX_10_EXP +4 +#define HALF_MAX_EXP +16 +#define HALF_MIN_10_EXP -4 +#define HALF_MIN_EXP -13 + +#endif + +#endif -- 2.7.4