diff --git a/libclc/generic/include/clc/clc.h b/libclc/generic/include/clc/clc.h index 17d84545d67d..f7085cea4192 100644 --- a/libclc/generic/include/clc/clc.h +++ b/libclc/generic/include/clc/clc.h @@ -114,6 +114,7 @@ #include #include #include +#include #include #include #include diff --git a/libclc/generic/include/clc/relational/isfinite.h b/libclc/generic/include/clc/relational/isfinite.h new file mode 100644 index 000000000000..48e261a54ff7 --- /dev/null +++ b/libclc/generic/include/clc/relational/isfinite.h @@ -0,0 +1,9 @@ +#undef isfinite + +#define __CLC_FUNCTION isfinite +#define __CLC_BODY + +#include + +#undef __CLC_BODY +#undef __CLC_FUNCTION diff --git a/libclc/generic/lib/SOURCES b/libclc/generic/lib/SOURCES index fb801249efa8..3c021183e9ad 100644 --- a/libclc/generic/lib/SOURCES +++ b/libclc/generic/lib/SOURCES @@ -49,6 +49,7 @@ math/sincos_helpers.cl relational/all.cl relational/any.cl relational/isequal.cl +relational/isfinite.cl relational/isgreater.cl relational/isgreaterequal.cl relational/isinf.cl diff --git a/libclc/generic/lib/relational/isfinite.cl b/libclc/generic/lib/relational/isfinite.cl new file mode 100644 index 000000000000..d0658c01eacb --- /dev/null +++ b/libclc/generic/lib/relational/isfinite.cl @@ -0,0 +1,18 @@ +#include +#include "relational.h" + +_CLC_DEFINE_RELATIONAL_UNARY(int, isfinite, __builtin_isfinite, float) + +#ifdef cl_khr_fp64 + +#pragma OPENCL EXTENSION cl_khr_fp64 : enable + +// The scalar version of isfinite(double) returns an int, but the vector versions +// return long. +_CLC_DEF _CLC_OVERLOAD int isfinite(double x) { + return __builtin_isfinite(x); +} + +_CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(long, isfinite, double) + +#endif