[libclc] r211680 - Add exp10

Jeroen Ketema j.ketema at imperial.ac.uk
Wed Jun 25 03:06:36 PDT 2014


Author: jketema
Date: Wed Jun 25 05:06:35 2014
New Revision: 211680

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

Reviewed-by: Tom Stellard <tom at stellard.net>

Added:
    libclc/trunk/generic/include/clc/math/exp10.h
    libclc/trunk/generic/include/clc/math/native_exp10.h
    libclc/trunk/generic/lib/math/exp10.cl
    libclc/trunk/generic/lib/math/exp10.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=211680&r1=211679&r2=211680&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Wed Jun 25 05:06:35 2014
@@ -35,6 +35,7 @@
 #include <clc/math/cos.h>
 #include <clc/math/ceil.h>
 #include <clc/math/exp.h>
+#include <clc/math/exp10.h>
 #include <clc/math/exp2.h>
 #include <clc/math/fabs.h>
 #include <clc/math/floor.h>
@@ -58,6 +59,7 @@
 #include <clc/math/native_cos.h>
 #include <clc/math/native_divide.h>
 #include <clc/math/native_exp.h>
+#include <clc/math/native_exp10.h>
 #include <clc/math/native_exp2.h>
 #include <clc/math/native_log.h>
 #include <clc/math/native_log2.h>

Added: libclc/trunk/generic/include/clc/math/exp10.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/exp10.h?rev=211680&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/math/exp10.h (added)
+++ libclc/trunk/generic/include/clc/math/exp10.h Wed Jun 25 05:06:35 2014
@@ -0,0 +1,9 @@
+#undef exp10
+
+#define __CLC_BODY <clc/math/unary_decl.inc>
+#define __CLC_FUNCTION exp10
+
+#include <clc/math/gentype.inc>
+
+#undef __CLC_BODY
+#undef __CLC_FUNCTION

Added: libclc/trunk/generic/include/clc/math/native_exp10.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_exp10.h?rev=211680&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/math/native_exp10.h (added)
+++ libclc/trunk/generic/include/clc/math/native_exp10.h Wed Jun 25 05:06:35 2014
@@ -0,0 +1 @@
+#define native_exp10 exp10

Modified: libclc/trunk/generic/lib/SOURCES
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=211680&r1=211679&r2=211680&view=diff
==============================================================================
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Wed Jun 25 05:06:35 2014
@@ -28,6 +28,7 @@ integer/sub_sat_if.ll
 integer/sub_sat_impl.ll
 integer/upsample.cl
 math/exp.cl
+math/exp10.cl
 math/fmax.cl
 math/fmin.cl
 math/hypot.cl

Added: libclc/trunk/generic/lib/math/exp10.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/exp10.cl?rev=211680&view=auto
==============================================================================
--- libclc/trunk/generic/lib/math/exp10.cl (added)
+++ libclc/trunk/generic/lib/math/exp10.cl Wed Jun 25 05:06:35 2014
@@ -0,0 +1,8 @@
+#include <clc/clc.h>
+
+#ifdef cl_khr_fp64
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+#endif
+
+#define __CLC_BODY <exp10.inc>
+#include <clc/math/gentype.inc>

Added: libclc/trunk/generic/lib/math/exp10.inc
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/exp10.inc?rev=211680&view=auto
==============================================================================
--- libclc/trunk/generic/lib/math/exp10.inc (added)
+++ libclc/trunk/generic/lib/math/exp10.inc Wed Jun 25 05:06:35 2014
@@ -0,0 +1,10 @@
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE exp10(__CLC_GENTYPE val) {
+  // exp10(x) = exp2(x * log2(10))
+#if __CLC_FPSIZE == 32
+  return exp2(val * log2(10.0f));
+#elif __CLC_FPSIZE == 64
+  return exp2(val * log2(10.0));
+#else
+#error unknown _CLC_FPSIZE
+#endif
+}





More information about the cfe-commits mailing list