[libclc] r211579 - Add half limits

Jeroen Ketema j.ketema at imperial.ac.uk
Tue Jun 24 02:51:01 PDT 2014


Author: jketema
Date: Tue Jun 24 04:51:01 2014
New Revision: 211579

URL: http://llvm.org/viewvc/llvm-project?rev=211579&view=rev
Log:
Add half limits

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 <tom at stellard.net>

Modified:
    libclc/trunk/generic/include/clc/float/definitions.h

Modified: libclc/trunk/generic/include/clc/float/definitions.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/float/definitions.h?rev=211579&r1=211578&r2=211579&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/float/definitions.h (original)
+++ libclc/trunk/generic/include/clc/float/definitions.h Tue Jun 24 04:51:01 2014
@@ -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





More information about the cfe-commits mailing list