aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGil Pitney <gil.pitney@linaro.org>2014-12-08 14:23:47 -0800
committerGil Pitney <gil.pitney@linaro.org>2014-12-08 14:23:47 -0800
commit76bd0a080cd23ea52bd88d0520b2f450ad33a6c5 (patch)
treeda1acc6a3bdaaacb2b08ece028e5eb45e387b0b2
parent5d2eb9a1fc2ea97f717f1f819a088364412c9ddc (diff)
builtins: Fixed nextafter builtin; updated INFINITY definition.
Redefined nextafter to use __builtin_nextafterf(), and INFINITY to use __builtin_inff(). This enables the Khronos basic test kernel_limit_constants to pass. Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
-rw-r--r--include/clc.h8
-rw-r--r--src/builtins/math.cl2
2 files changed, 7 insertions, 3 deletions
diff --git a/include/clc.h b/include/clc.h
index c6e6b5d..4828f7d 100644
--- a/include/clc.h
+++ b/include/clc.h
@@ -855,7 +855,7 @@ SELECT_EXPAND_TYPES
#define MAXFLOAT FLT_MAX
#define HUGE_VALF __builtin_huge_valf()
-#define INFINITY (1.0f / 0.0f)
+#define INFINITY __builtin_inff()
#define NAN (0.0f / 0.0f)
#define HUGE_VAL __builtin_huge_val()
@@ -998,7 +998,11 @@ _CLC_OVERLOAD _CLC_INLINE double nan(ulong nancode)
UNARY_VEC_DECL(uint, float, nan)
UNARY_VEC_DECL(ulong, double, nan)
-BINARY(nextafter)
+BINARY_INLINE (float, float, nextafter, __builtin_nextafterf)
+BINARY_INLINE (double, double, nextafter, __builtin_nextafter)
+BINARY_VEC_DECL(float, float, nextafter)
+BINARY_VEC_DECL(double, double, nextafter)
+
BINARY(pow)
_CLC_PROTECTED double builtin_pow(double x, double y);
diff --git a/src/builtins/math.cl b/src/builtins/math.cl
index 02db08b..060b92c 100644
--- a/src/builtins/math.cl
+++ b/src/builtins/math.cl
@@ -116,7 +116,7 @@ BINARY_NO_BUILTIN(minmag)
UNARY_VEC_DEF(uint, float, nan, nan)
UNARY_VEC_DEF(ulong, double, nan, nan)
-BINARY(nextafter)
+BINARY_NO_BUILTIN(nextafter)
BINARY(pow)
BINARY_VEC_DEF_ALT(float, float, int, pown, powf)