[Libclc-dev] [PATCH 12/14] native_tan: Switch implementaiton to use native_sin/native_cos

Jeroen Ketema via Libclc-dev libclc-dev at lists.llvm.org
Sun Nov 12 14:14:05 PST 2017


LGTM

Jeroen

> On 4 Nov 2017, at 00:07, Jan Vesely via Libclc-dev <libclc-dev at lists.llvm.org> wrote:
> 
> Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
> ---
> generic/include/clc/math/native_tan.h | 17 ++++++++---------
> generic/lib/SOURCES                   |  1 +
> generic/lib/math/native_tan.cl        |  5 +++++
> generic/lib/math/native_tan.inc       |  3 +++
> 4 files changed, 17 insertions(+), 9 deletions(-)
> create mode 100644 generic/lib/math/native_tan.cl
> create mode 100644 generic/lib/math/native_tan.inc
> 
> diff --git a/generic/include/clc/math/native_tan.h b/generic/include/clc/math/native_tan.h
> index cb44538..317b0e5 100644
> --- a/generic/include/clc/math/native_tan.h
> +++ b/generic/include/clc/math/native_tan.h
> @@ -1,10 +1,9 @@
> -//===-- generic/include/clc/math/native_tan.h -----------------------------===//
> +#define __CLC_BODY <clc/math/unary_decl.inc>
> +#define __CLC_FUNCTION native_tan
> +#define __FLOAT_ONLY
> 
> -//
> -//                     The LLVM Compiler Infrastructure
> -//
> -// This file is dual licensed under both the University of Illinois Open Source
> -// License and the MIT license. See LICENSE.TXT for details.
> -//
> -//===----------------------------------------------------------------------===//
> -#define native_tan tan
> +#include <clc/math/gentype.inc>
> +
> +#undef __FLOAT_ONLY
> +#undef __CLC_BODY
> +#undef __CLC_FUNCTION
> diff --git a/generic/lib/SOURCES b/generic/lib/SOURCES
> index 2b31465..b5e8c92 100644
> --- a/generic/lib/SOURCES
> +++ b/generic/lib/SOURCES
> @@ -128,6 +128,7 @@ math/native_log10.cl
> math/native_log2.cl
> math/native_sin.cl
> math/native_sqrt.cl
> +math/native_tan.cl
> math/tables.cl
> math/clc_nextafter.cl
> math/nextafter.cl
> diff --git a/generic/lib/math/native_tan.cl b/generic/lib/math/native_tan.cl
> new file mode 100644
> index 0000000..33f6d5f
> --- /dev/null
> +++ b/generic/lib/math/native_tan.cl
> @@ -0,0 +1,5 @@
> +#include <clc/clc.h>
> +
> +#define __CLC_BODY <native_tan.inc>
> +#define __FLOAT_ONLY
> +#include <clc/math/gentype.inc>
> diff --git a/generic/lib/math/native_tan.inc b/generic/lib/math/native_tan.inc
> new file mode 100644
> index 0000000..61a8517
> --- /dev/null
> +++ b/generic/lib/math/native_tan.inc
> @@ -0,0 +1,3 @@
> +_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_tan(__CLC_GENTYPE val) {
> +  return native_sin(val) / native_cos(val);
> +}
> -- 
> 2.13.6
> 
> _______________________________________________
> Libclc-dev mailing list
> Libclc-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev



More information about the Libclc-dev mailing list