[Libclc-dev] [PATCH 2/2] Implement isinf builtin
Aaron Watry
awatry at gmail.com
Tue Sep 2 14:36:48 PDT 2014
The good news: It's almost identical to a WIP patch that I hadn't
sent into the list yet (besides the usage of
<clc/relational/floatn.inc> in my version).
The bad news: It results in the following for both EG and SI for me:
LLVM triggered Diagnostic Handler: unsupported call to function fabsf
in test_1_isinf_float
Segmentation fault (core dumped)
Curiously, the fabs() tests that I just wrote seem to be ok (which
uses the llvm.fabs intrinsic)
kernel and bitcode of builtin-float-isinf-1.0.generated.cl (just the
scalar float test) is attached just in case it helps.
--Aaron
On Tue, Sep 2, 2014 at 2:12 PM, Tom Stellard <thomas.stellard at amd.com> wrote:
> ---
> generic/include/clc/clc.h | 1 +
> generic/include/clc/relational/isinf.h | 21 +++++++++++++++++++++
> generic/lib/SOURCES | 1 +
> generic/lib/relational/isinf.cl | 18 ++++++++++++++++++
> 4 files changed, 41 insertions(+)
> create mode 100644 generic/include/clc/relational/isinf.h
> create mode 100644 generic/lib/relational/isinf.cl
>
> diff --git a/generic/include/clc/clc.h b/generic/include/clc/clc.h
> index 12114fe..490893b 100644
> --- a/generic/include/clc/clc.h
> +++ b/generic/include/clc/clc.h
> @@ -117,6 +117,7 @@
> #include <clc/relational/isequal.h>
> #include <clc/relational/isgreater.h>
> #include <clc/relational/isgreaterequal.h>
> +#include <clc/relational/isinf.h>
> #include <clc/relational/isless.h>
> #include <clc/relational/islessequal.h>
> #include <clc/relational/isnan.h>
> diff --git a/generic/include/clc/relational/isinf.h b/generic/include/clc/relational/isinf.h
> new file mode 100644
> index 0000000..869f0c8
> --- /dev/null
> +++ b/generic/include/clc/relational/isinf.h
> @@ -0,0 +1,21 @@
> +
> +#define _CLC_ISINF_DECL(RET_TYPE, ARG_TYPE) \
> + _CLC_OVERLOAD _CLC_DECL RET_TYPE isinf(ARG_TYPE);
> +
> +#define _CLC_VECTOR_ISINF_DECL(RET_TYPE, ARG_TYPE) \
> + _CLC_ISINF_DECL(RET_TYPE##2, ARG_TYPE##2) \
> + _CLC_ISINF_DECL(RET_TYPE##3, ARG_TYPE##3) \
> + _CLC_ISINF_DECL(RET_TYPE##4, ARG_TYPE##4) \
> + _CLC_ISINF_DECL(RET_TYPE##8, ARG_TYPE##8) \
> + _CLC_ISINF_DECL(RET_TYPE##16, ARG_TYPE##16)
> +
> +_CLC_ISINF_DECL(int, float)
> +_CLC_VECTOR_ISINF_DECL(int, float)
> +
> +#ifdef cl_khr_fp64
> +_CLC_ISINF_DECL(int, double)
> +_CLC_VECTOR_ISINF_DECL(long, double)
> +#endif
> +
> +#undef _CLC_ISINF_DECL
> +#undef _CLC_VECTOR_ISINF_DECL
> diff --git a/generic/lib/SOURCES b/generic/lib/SOURCES
> index ced53f3..8eaaa61 100644
> --- a/generic/lib/SOURCES
> +++ b/generic/lib/SOURCES
> @@ -52,6 +52,7 @@ relational/any.cl
> relational/isequal.cl
> relational/isgreater.cl
> relational/isgreaterequal.cl
> +relational/isinf.cl
> relational/isless.cl
> relational/islessequal.cl
> relational/isnan.cl
> diff --git a/generic/lib/relational/isinf.cl b/generic/lib/relational/isinf.cl
> new file mode 100644
> index 0000000..1452d91
> --- /dev/null
> +++ b/generic/lib/relational/isinf.cl
> @@ -0,0 +1,18 @@
> +#include <clc/clc.h>
> +#include "relational.h"
> +
> +_CLC_DEFINE_RELATIONAL_UNARY(int, isinf, __builtin_isinf, float)
> +
> +#ifdef cl_khr_fp64
> +
> +#pragma OPENCL EXTENSION cl_khr_fp64 : enable
> +
> +// The scalar version of isinf(double) returns an int, but the vector versions
> +// return long.
> +_CLC_DEF _CLC_OVERLOAD int isinf(double x) {
> + return __builtin_isinf(x);
> +}
> +
> +_CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(long, isinf, double)
> +
> +#endif
> --
> 1.8.5.5
>
>
> _______________________________________________
> Libclc-dev mailing list
> Libclc-dev at pcc.me.uk
> http://www.pcc.me.uk/cgi-bin/mailman/listinfo/libclc-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: isinf.cl
Type: application/octet-stream
Size: 336 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libclc-dev/attachments/20140902/16aed62d/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: isinf.ll
Type: application/octet-stream
Size: 1779 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libclc-dev/attachments/20140902/16aed62d/attachment-0005.obj>
More information about the Libclc-dev
mailing list