[libclc] r204478 - Add sincos

Tom Stellard thomas.stellard at amd.com
Fri Mar 21 09:22:02 PDT 2014


Author: tstellar
Date: Fri Mar 21 11:22:01 2014
New Revision: 204478

URL: http://llvm.org/viewvc/llvm-project?rev=204478&view=rev
Log:
Add sincos

Patch by: Jeroen Ketema

Reviewed-by: Tom Stellard <thomas.stellard at amd.com>

Added:
    libclc/trunk/generic/include/clc/math/sincos.h
    libclc/trunk/generic/include/clc/math/sincos.inc
    libclc/trunk/generic/lib/math/sincos.cl
    libclc/trunk/generic/lib/math/sincos.inc
Modified:
    libclc/trunk/generic/include/clc/clc.h
    libclc/trunk/generic/lib/SOURCES

Modified: libclc/trunk/generic/include/clc/clc.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=204478&r1=204477&r2=204478&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Fri Mar 21 11:22:01 2014
@@ -50,6 +50,7 @@
 #include <clc/math/rint.h>
 #include <clc/math/round.h>
 #include <clc/math/sin.h>
+#include <clc/math/sincos.h>
 #include <clc/math/sqrt.h>
 #include <clc/math/trunc.h>
 #include <clc/math/native_cos.h>

Added: libclc/trunk/generic/include/clc/math/sincos.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/sincos.h?rev=204478&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/math/sincos.h (added)
+++ libclc/trunk/generic/include/clc/math/sincos.h Fri Mar 21 11:22:01 2014
@@ -0,0 +1,2 @@
+#define __CLC_BODY <clc/math/sincos.inc>
+#include <clc/math/gentype.inc>

Added: libclc/trunk/generic/include/clc/math/sincos.inc
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/sincos.inc?rev=204478&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/math/sincos.inc (added)
+++ libclc/trunk/generic/include/clc/math/sincos.inc Fri Mar 21 11:22:01 2014
@@ -0,0 +1,8 @@
+#define __CLC_DECLARE_SINCOS(ADDRSPACE, TYPE) \
+  _CLC_OVERLOAD _CLC_DECL TYPE sincos (TYPE x, ADDRSPACE TYPE * cosval);
+
+__CLC_DECLARE_SINCOS(global, __CLC_GENTYPE)
+__CLC_DECLARE_SINCOS(local, __CLC_GENTYPE)
+__CLC_DECLARE_SINCOS(private, __CLC_GENTYPE)
+
+#undef __CLC_DECLARE_SINCOS

Modified: libclc/trunk/generic/lib/SOURCES
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=204478&r1=204477&r2=204478&view=diff
==============================================================================
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Fri Mar 21 11:22:01 2014
@@ -33,6 +33,7 @@ math/hypot.cl
 math/mad.cl
 math/clc_nextafter.cl
 math/nextafter.cl
+math/sincos.cl
 relational/any.cl
 relational/isnan.cl
 shared/clamp.cl

Added: libclc/trunk/generic/lib/math/sincos.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/sincos.cl?rev=204478&view=auto
==============================================================================
--- libclc/trunk/generic/lib/math/sincos.cl (added)
+++ libclc/trunk/generic/lib/math/sincos.cl Fri Mar 21 11:22:01 2014
@@ -0,0 +1,8 @@
+#include <clc/clc.h>
+
+#ifdef cl_khr_fp64
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+#endif
+
+#define __CLC_BODY <sincos.inc>
+#include <clc/math/gentype.inc>

Added: libclc/trunk/generic/lib/math/sincos.inc
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/sincos.inc?rev=204478&view=auto
==============================================================================
--- libclc/trunk/generic/lib/math/sincos.inc (added)
+++ libclc/trunk/generic/lib/math/sincos.inc Fri Mar 21 11:22:01 2014
@@ -0,0 +1,11 @@
+#define __CLC_DECLARE_SINCOS(ADDRSPACE, TYPE) \
+  _CLC_OVERLOAD _CLC_DEF TYPE sincos (TYPE x, ADDRSPACE TYPE * cosval) { \
+    *cosval = cos(x); \
+    return sin(x); \
+  }
+
+__CLC_DECLARE_SINCOS(global, __CLC_GENTYPE)
+__CLC_DECLARE_SINCOS(local, __CLC_GENTYPE)
+__CLC_DECLARE_SINCOS(private, __CLC_GENTYPE)
+
+#undef __CLC_DECLARE_SINCOS





More information about the cfe-commits mailing list