[libclc] r211211 - Add pown
Jeroen Ketema
j.ketema at imperial.ac.uk
Wed Jun 18 12:42:23 PDT 2014
Author: jketema
Date: Wed Jun 18 14:42:23 2014
New Revision: 211211
URL: http://llvm.org/viewvc/llvm-project?rev=211211&view=rev
Log:
Add pown
Reviewed-by: Tom Stellard <tom at stellard.net>
Added:
libclc/trunk/generic/include/clc/math/pown.h
libclc/trunk/generic/lib/math/pown.cl
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=211211&r1=211210&r2=211211&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Wed Jun 18 14:42:23 2014
@@ -48,6 +48,7 @@
#include <clc/math/mix.h>
#include <clc/math/nextafter.h>
#include <clc/math/pow.h>
+#include <clc/math/pown.h>
#include <clc/math/rint.h>
#include <clc/math/round.h>
#include <clc/math/sin.h>
Added: libclc/trunk/generic/include/clc/math/pown.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/pown.h?rev=211211&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/math/pown.h (added)
+++ libclc/trunk/generic/include/clc/math/pown.h Wed Jun 18 14:42:23 2014
@@ -0,0 +1,24 @@
+#define _CLC_POWN_INTRINSIC "llvm.powi"
+
+#define _CLC_POWN_DECL(GENTYPE, INTTYPE) \
+ _CLC_OVERLOAD _CLC_DECL GENTYPE pown(GENTYPE x, INTTYPE y);
+
+#define _CLC_VECTOR_POWN_DECL(GENTYPE, INTTYPE) \
+ _CLC_POWN_DECL(GENTYPE##2, INTTYPE##2) \
+ _CLC_POWN_DECL(GENTYPE##3, INTTYPE##3) \
+ _CLC_POWN_DECL(GENTYPE##4, INTTYPE##4) \
+ _CLC_POWN_DECL(GENTYPE##8, INTTYPE##8) \
+ _CLC_POWN_DECL(GENTYPE##16, INTTYPE##16)
+
+_CLC_OVERLOAD float pown(float x, int y) __asm(_CLC_POWN_INTRINSIC ".f32");
+
+_CLC_VECTOR_POWN_DECL(float, int)
+
+#ifdef cl_khr_fp64
+_CLC_OVERLOAD double pown(double x, int y) __asm(_CLC_POWN_INTRINSIC ".f64");
+_CLC_VECTOR_POWN_DECL(double, int)
+#endif
+
+#undef _CLC_POWN_INTRINSIC
+#undef _CLC_POWN_DECL
+#undef _CLC_VECTOR_POWN_DECL
Modified: libclc/trunk/generic/lib/SOURCES
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=211211&r1=211210&r2=211211&view=diff
==============================================================================
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Wed Jun 18 14:42:23 2014
@@ -35,6 +35,7 @@ math/mad.cl
math/mix.cl
math/clc_nextafter.cl
math/nextafter.cl
+math/pown.cl
math/sincos.cl
relational/all.cl
relational/any.cl
Added: libclc/trunk/generic/lib/math/pown.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/pown.cl?rev=211211&view=auto
==============================================================================
--- libclc/trunk/generic/lib/math/pown.cl (added)
+++ libclc/trunk/generic/lib/math/pown.cl Wed Jun 18 14:42:23 2014
@@ -0,0 +1,9 @@
+#include <clc/clc.h>
+
+_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, pown, float, int)
+
+#ifdef cl_khr_fp64
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, pown, double, int)
+#endif
More information about the cfe-commits
mailing list