From 76bd0a080cd23ea52bd88d0520b2f450ad33a6c5 Mon Sep 17 00:00:00 2001 From: Gil Pitney Date: Mon, 8 Dec 2014 14:23:47 -0800 Subject: 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 --- include/clc.h | 8 ++++++-- src/builtins/math.cl | 2 +- 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) -- cgit v1.2.3