summaryrefslogtreecommitdiff
path: root/generic/include/clc
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2012-05-29 17:42:56 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2012-05-29 17:42:56 +0000
commit257a3ba282147a947c8e0e5540d299cc65e82471 (patch)
tree4a2517432e93400ca281e13b8f687c45c273e358 /generic/include/clc
parent65f1c28f5dab19b12b3a00abd558bed9640901ba (diff)
Add pow builtin.
git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@157629 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'generic/include/clc')
-rw-r--r--generic/include/clc/clc.h1
-rw-r--r--generic/include/clc/math/binary_intrin.inc18
-rw-r--r--generic/include/clc/math/pow.h6
3 files changed, 25 insertions, 0 deletions
diff --git a/generic/include/clc/clc.h b/generic/include/clc/clc.h
index 2833871..b0cbd4a 100644
--- a/generic/include/clc/clc.h
+++ b/generic/include/clc/clc.h
@@ -41,6 +41,7 @@
#include <clc/math/log.h>
#include <clc/math/log2.h>
#include <clc/math/mad.h>
+#include <clc/math/pow.h>
#include <clc/math/sin.h>
#include <clc/math/sqrt.h>
#include <clc/math/native_cos.h>
diff --git a/generic/include/clc/math/binary_intrin.inc b/generic/include/clc/math/binary_intrin.inc
new file mode 100644
index 0000000..30dec7b
--- /dev/null
+++ b/generic/include/clc/math/binary_intrin.inc
@@ -0,0 +1,18 @@
+_CLC_OVERLOAD float FUNCTION(float, float) __asm(INTRINSIC ".f32");
+_CLC_OVERLOAD float2 FUNCTION(float2, float2) __asm(INTRINSIC ".v2f32");
+_CLC_OVERLOAD float3 FUNCTION(float3, float3) __asm(INTRINSIC ".v3f32");
+_CLC_OVERLOAD float4 FUNCTION(float4, float4) __asm(INTRINSIC ".v4f32");
+_CLC_OVERLOAD float8 FUNCTION(float8, float8) __asm(INTRINSIC ".v8f32");
+_CLC_OVERLOAD float16 FUNCTION(float16, float16) __asm(INTRINSIC ".v16f32");
+
+#ifdef cl_khr_fp64
+_CLC_OVERLOAD double FUNCTION(double, double) __asm(INTRINSIC ".f64");
+_CLC_OVERLOAD double2 FUNCTION(double2, double2) __asm(INTRINSIC ".v2f64");
+_CLC_OVERLOAD double3 FUNCTION(double3, double3) __asm(INTRINSIC ".v3f64");
+_CLC_OVERLOAD double4 FUNCTION(double4, double4) __asm(INTRINSIC ".v4f64");
+_CLC_OVERLOAD double8 FUNCTION(double8, double8) __asm(INTRINSIC ".v8f64");
+_CLC_OVERLOAD double16 FUNCTION(double16, double16) __asm(INTRINSIC ".v16f64");
+#endif
+
+#undef FUNCTION
+#undef INTRINSIC
diff --git a/generic/include/clc/math/pow.h b/generic/include/clc/math/pow.h
new file mode 100644
index 0000000..208d06d
--- /dev/null
+++ b/generic/include/clc/math/pow.h
@@ -0,0 +1,6 @@
+#undef pow
+#define pow __clc_pow
+
+#define FUNCTION __clc_pow
+#define INTRINSIC "llvm.pow"
+#include <clc/math/binary_intrin.inc>