[libclc] r211065 - Fix definition of INFINITY and add NAN/HUGE_VAL[F]
Aaron Watry
awatry at gmail.com
Mon Jun 16 15:32:58 PDT 2014
Author: awatry
Date: Mon Jun 16 17:32:58 2014
New Revision: 211065
URL: http://llvm.org/viewvc/llvm-project?rev=211065&view=rev
Log:
Fix definition of INFINITY and add NAN/HUGE_VAL[F]
v3: change __builtin_nanf() to __builtin_nanf("")
This doesn't work yet, but it was agreed to commit as-is with the logic
that "broken" is better than "completely missing" and this should be
fixed in clang.
v2: use __builtin_inff() and also add nan/huge_val definitions
Signed-off-by: Aaron Watry <awatry at gmail.com>
Modified:
libclc/trunk/generic/include/clc/float/definitions.h
libclc/trunk/generic/lib/gen_convert.py
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=211065&r1=211064&r2=211065&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/float/definitions.h (original)
+++ libclc/trunk/generic/include/clc/float/definitions.h Mon Jun 16 17:32:58 2014
@@ -1,3 +1,7 @@
+#define INFINITY __builtin_inff()
+#define NAN __builtin_nanf("")
+#define HUGE_VALF __builtin_huge_valf()
+
#define FLT_DIG 6
#define FLT_MANT_DIG 24
#define FLT_MAX_10_EXP +38
@@ -25,6 +29,8 @@
#ifdef cl_khr_fp64
+#define HUGE_VAL __builtin_huge_val()
+
#define DBL_DIG 15
#define DBL_MANT_DIG 53
#define DBL_MAX_10_EXP +308
Modified: libclc/trunk/generic/lib/gen_convert.py
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/gen_convert.py?rev=211065&r1=211064&r2=211065&view=diff
==============================================================================
--- libclc/trunk/generic/lib/gen_convert.py (original)
+++ libclc/trunk/generic/lib/gen_convert.py Mon Jun 16 17:32:58 2014
@@ -144,8 +144,6 @@ print("""/* !!!! AUTOGENERATED FILE gene
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
#endif
-#define INFINITY 1.0f / 0.0f
-
""")
#
More information about the cfe-commits
mailing list