[cfe-commits] [libclc] r157598 - in /libclc/trunk/generic/include/clc: clc.h math/exp.h math/exp2.h math/log.h math/log2.h math/native_exp.h math/native_exp2.h math/native_log.h math/native_log2.h
Peter Collingbourne
peter at pcc.me.uk
Mon May 28 17:42:30 PDT 2012
Author: pcc
Date: Mon May 28 19:42:29 2012
New Revision: 157598
URL: http://llvm.org/viewvc/llvm-project?rev=157598&view=rev
Log:
Implement exp, exp2, log, log2, native_exp, native_exp2, native_log,
native_log2. Patch by Joshua Cranmer!
Added:
libclc/trunk/generic/include/clc/math/exp.h
libclc/trunk/generic/include/clc/math/exp2.h
libclc/trunk/generic/include/clc/math/log.h
libclc/trunk/generic/include/clc/math/log2.h
libclc/trunk/generic/include/clc/math/native_exp.h
libclc/trunk/generic/include/clc/math/native_exp2.h
libclc/trunk/generic/include/clc/math/native_log.h
libclc/trunk/generic/include/clc/math/native_log2.h
Modified:
libclc/trunk/generic/include/clc/clc.h
Modified: libclc/trunk/generic/include/clc/clc.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=157598&r1=157597&r2=157598&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Mon May 28 19:42:29 2012
@@ -33,11 +33,19 @@
/* 6.11.2 Math Functions */
#include <clc/math/cos.h>
+#include <clc/math/exp.h>
+#include <clc/math/exp2.h>
#include <clc/math/fabs.h>
+#include <clc/math/log.h>
+#include <clc/math/log2.h>
#include <clc/math/sin.h>
#include <clc/math/sqrt.h>
#include <clc/math/native_cos.h>
#include <clc/math/native_divide.h>
+#include <clc/math/native_exp.h>
+#include <clc/math/native_exp2.h>
+#include <clc/math/native_log.h>
+#include <clc/math/native_log2.h>
#include <clc/math/native_sin.h>
#include <clc/math/native_sqrt.h>
Added: libclc/trunk/generic/include/clc/math/exp.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/exp.h?rev=157598&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/math/exp.h (added)
+++ libclc/trunk/generic/include/clc/math/exp.h Mon May 28 19:42:29 2012
@@ -0,0 +1,4 @@
+#undef exp
+
+// exp(x) = exp2(x * log2(e)
+#define exp(val) (__clc_exp2((val) * 1.44269504f))
Added: libclc/trunk/generic/include/clc/math/exp2.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/exp2.h?rev=157598&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/math/exp2.h (added)
+++ libclc/trunk/generic/include/clc/math/exp2.h Mon May 28 19:42:29 2012
@@ -0,0 +1,6 @@
+#undef exp2
+#define exp2 __clc_exp2
+
+#define FUNCTION __clc_exp2
+#define INTRINSIC "llvm.exp2"
+#include <clc/math/unary_intrin.inc>
Added: libclc/trunk/generic/include/clc/math/log.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/log.h?rev=157598&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/math/log.h (added)
+++ libclc/trunk/generic/include/clc/math/log.h Mon May 28 19:42:29 2012
@@ -0,0 +1,4 @@
+#undef log
+
+// log(x) = log2(x) * (1/log2(e))
+#define log(val) (__clc_log2(val) * 0.693147181f)
Added: libclc/trunk/generic/include/clc/math/log2.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/log2.h?rev=157598&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/math/log2.h (added)
+++ libclc/trunk/generic/include/clc/math/log2.h Mon May 28 19:42:29 2012
@@ -0,0 +1,6 @@
+#undef log2
+#define log2 __clc_log2
+
+#define FUNCTION __clc_log2
+#define INTRINSIC "llvm.log2"
+#include <clc/math/unary_intrin.inc>
Added: libclc/trunk/generic/include/clc/math/native_exp.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_exp.h?rev=157598&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/math/native_exp.h (added)
+++ libclc/trunk/generic/include/clc/math/native_exp.h Mon May 28 19:42:29 2012
@@ -0,0 +1 @@
+#define native_exp exp
Added: libclc/trunk/generic/include/clc/math/native_exp2.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_exp2.h?rev=157598&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/math/native_exp2.h (added)
+++ libclc/trunk/generic/include/clc/math/native_exp2.h Mon May 28 19:42:29 2012
@@ -0,0 +1 @@
+#define native_exp2 exp2
Added: libclc/trunk/generic/include/clc/math/native_log.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_log.h?rev=157598&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/math/native_log.h (added)
+++ libclc/trunk/generic/include/clc/math/native_log.h Mon May 28 19:42:29 2012
@@ -0,0 +1 @@
+#define native_log log
Added: libclc/trunk/generic/include/clc/math/native_log2.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/native_log2.h?rev=157598&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/math/native_log2.h (added)
+++ libclc/trunk/generic/include/clc/math/native_log2.h Mon May 28 19:42:29 2012
@@ -0,0 +1 @@
+#define native_log2 log2
More information about the cfe-commits
mailing list