From 541a3f07589bc92fcb14b85f6e12f4d56cd504de Mon Sep 17 00:00:00 2001 From: Jan Vesely Date: Mon, 13 Nov 2017 18:28:48 +0000 Subject: [PATCH] native_tan: Switch implementation to use native_sin/native_cos Reviewer: Jeroen Ketema Signed-off-by: Jan Vesely llvm-svn: 318064 --- libclc/generic/include/clc/math/native_tan.h | 17 ++++++++--------- libclc/generic/lib/SOURCES | 1 + libclc/generic/lib/math/native_tan.cl | 5 +++++ libclc/generic/lib/math/native_tan.inc | 3 +++ 4 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 libclc/generic/lib/math/native_tan.cl create mode 100644 libclc/generic/lib/math/native_tan.inc diff --git a/libclc/generic/include/clc/math/native_tan.h b/libclc/generic/include/clc/math/native_tan.h index cb4453895c56..317b0e55c463 100644 --- a/libclc/generic/include/clc/math/native_tan.h +++ b/libclc/generic/include/clc/math/native_tan.h @@ -1,10 +1,9 @@ -//===-- generic/include/clc/math/native_tan.h -----------------------------===// +#define __CLC_BODY +#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 + +#undef __FLOAT_ONLY +#undef __CLC_BODY +#undef __CLC_FUNCTION diff --git a/libclc/generic/lib/SOURCES b/libclc/generic/lib/SOURCES index 2b314653a887..b5e8c9260844 100644 --- a/libclc/generic/lib/SOURCES +++ b/libclc/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/libclc/generic/lib/math/native_tan.cl b/libclc/generic/lib/math/native_tan.cl new file mode 100644 index 000000000000..33f6d5f179dc --- /dev/null +++ b/libclc/generic/lib/math/native_tan.cl @@ -0,0 +1,5 @@ +#include + +#define __CLC_BODY +#define __FLOAT_ONLY +#include diff --git a/libclc/generic/lib/math/native_tan.inc b/libclc/generic/lib/math/native_tan.inc new file mode 100644 index 000000000000..61a8517e77d6 --- /dev/null +++ b/libclc/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); +}