native_tan: Switch implementation to use native_sin/native_cos
authorJan Vesely <jan.vesely@rutgers.edu>
Mon, 13 Nov 2017 18:28:48 +0000 (18:28 +0000)
committerJan Vesely <jan.vesely@rutgers.edu>
Mon, 13 Nov 2017 18:28:48 +0000 (18:28 +0000)
Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 318064

libclc/generic/include/clc/math/native_tan.h
libclc/generic/lib/SOURCES
libclc/generic/lib/math/native_tan.cl [new file with mode: 0644]
libclc/generic/lib/math/native_tan.inc [new file with mode: 0644]

index cb44538..317b0e5 100644 (file)
@@ -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
index 2b31465..b5e8c92 100644 (file)
@@ -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 (file)
index 0000000..33f6d5f
--- /dev/null
@@ -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/libclc/generic/lib/math/native_tan.inc b/libclc/generic/lib/math/native_tan.inc
new file mode 100644 (file)
index 0000000..61a8517
--- /dev/null
@@ -0,0 +1,3 @@
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE native_tan(__CLC_GENTYPE val) {
+  return native_sin(val) / native_cos(val);
+}