[Libclc-dev] [PATCH 1/2] Add pown

Tom Stellard tom at stellard.net
Tue Jun 17 07:36:31 PDT 2014


On Tue, Jun 17, 2014 at 03:23:40PM +0100, Jeroen Ketema wrote:

LGTM.

> ---
> generic/include/clc/clc.h       |  1 +
> generic/include/clc/math/pown.h | 24 ++++++++++++++++++++++++
> generic/lib/SOURCES             |  1 +
> generic/lib/math/pown.cl        |  9 +++++++++
> 4 files changed, 35 insertions(+)
> create mode 100644 generic/include/clc/math/pown.h
> create mode 100644 generic/lib/math/pown.cl
> 
> diff --git a/generic/include/clc/clc.h b/generic/include/clc/clc.h
> index e0cae98..a975c0d 100644
> --- a/generic/include/clc/clc.h
> +++ b/generic/include/clc/clc.h
> @@ -48,6 +48,7 @@
> #include <clc/math/mix.h>
> #include <clc/math/nextafter.h>
> #include <clc/math/pow.h>
> +#include <clc/math/pown.h>
> #include <clc/math/rint.h>
> #include <clc/math/round.h>
> #include <clc/math/sin.h>
> diff --git a/generic/include/clc/math/pown.h b/generic/include/clc/math/pown.h
> new file mode 100644
> index 0000000..bdbf50c
> --- /dev/null
> +++ b/generic/include/clc/math/pown.h
> @@ -0,0 +1,24 @@
> +#define _CLC_POWN_INTRINSIC "llvm.powi"
> +
> +#define _CLC_POWN_DECL(GENTYPE, INTTYPE) \
> +  _CLC_OVERLOAD _CLC_DECL GENTYPE pown(GENTYPE x, INTTYPE y);
> +
> +#define _CLC_VECTOR_POWN_DECL(GENTYPE, INTTYPE) \
> +  _CLC_POWN_DECL(GENTYPE##2, INTTYPE##2)  \
> +  _CLC_POWN_DECL(GENTYPE##3, INTTYPE##3)  \
> +  _CLC_POWN_DECL(GENTYPE##4, INTTYPE##4)  \
> +  _CLC_POWN_DECL(GENTYPE##8, INTTYPE##8)  \
> +  _CLC_POWN_DECL(GENTYPE##16, INTTYPE##16)
> +
> +_CLC_OVERLOAD float pown(float x, int y) __asm(_CLC_POWN_INTRINSIC ".f32");
> +
> +_CLC_VECTOR_POWN_DECL(float, int)
> +
> +#ifdef cl_khr_fp64
> +_CLC_OVERLOAD double pown(double x, int y) __asm(_CLC_POWN_INTRINSIC ".f64");
> +_CLC_VECTOR_POWN_DECL(double, int)
> +#endif
> +
> +#undef _CLC_POWN_INTRINSIC
> +#undef _CLC_POWN_DECL
> +#undef _CLC_VECTOR_POWN_DECL
> diff --git a/generic/lib/SOURCES b/generic/lib/SOURCES
> index 02894d9..72f890b 100644
> --- a/generic/lib/SOURCES
> +++ b/generic/lib/SOURCES
> @@ -35,6 +35,7 @@ math/mad.cl
> math/mix.cl
> math/clc_nextafter.cl
> math/nextafter.cl
> +math/pown.cl
> math/sincos.cl
> relational/all.cl
> relational/any.cl
> diff --git a/generic/lib/math/pown.cl b/generic/lib/math/pown.cl
> new file mode 100644
> index 0000000..46b354b
> --- /dev/null
> +++ b/generic/lib/math/pown.cl
> @@ -0,0 +1,9 @@
> +#include <clc/clc.h>
> +
> +_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, pown, float, int)
> +
> +#ifdef cl_khr_fp64
> +#pragma OPENCL EXTENSION cl_khr_fp64 : enable
> +
> +_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, pown, double, int)
> +#endif
> -- 
> 1.8.5.2 (Apple Git-48)
> 
> 
> _______________________________________________
> Libclc-dev mailing list
> Libclc-dev at pcc.me.uk
> http://www.pcc.me.uk/cgi-bin/mailman/listinfo/libclc-dev




More information about the Libclc-dev mailing list