summaryrefslogtreecommitdiffstats
path: root/libclc
diff options
context:
space:
mode:
authorJan Vesely <jan.vesely@rutgers.edu>2014-10-05 20:24:52 +0000
committerJan Vesely <jan.vesely@rutgers.edu>2014-10-05 20:24:52 +0000
commit8f64c3d84213aabcfc2e033335a73290ab7ea059 (patch)
treea7d193b361889bd08f8a3f27e68cfde674bdacdf /libclc
parentdaa1ff985cd19e75860a4fb7ce6491c063354128 (diff)
downloadbcm5719-llvm-8f64c3d84213aabcfc2e033335a73290ab7ea059.tar.gz
bcm5719-llvm-8f64c3d84213aabcfc2e033335a73290ab7ea059.zip
Implement fmod
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> Reviewed-by: Tom Stellard <tom@stellard.net> Reviewed-by: Aaron Watry <awatry@gmail.com> llvm-svn: 219087
Diffstat (limited to 'libclc')
-rw-r--r--libclc/generic/include/clc/clc.h1
-rw-r--r--libclc/generic/include/clc/math/fmod.h2
-rw-r--r--libclc/generic/include/clc/math/fmod.inc1
-rw-r--r--libclc/generic/lib/SOURCES1
-rw-r--r--libclc/generic/lib/math/fmod.cl12
5 files changed, 17 insertions, 0 deletions
diff --git a/libclc/generic/include/clc/clc.h b/libclc/generic/include/clc/clc.h
index 2afbcfdaccd..ff63fb0c32f 100644
--- a/libclc/generic/include/clc/clc.h
+++ b/libclc/generic/include/clc/clc.h
@@ -47,6 +47,7 @@
#include <clc/math/fma.h>
#include <clc/math/fmax.h>
#include <clc/math/fmin.h>
+#include <clc/math/fmod.h>
#include <clc/math/hypot.h>
#include <clc/math/log.h>
#include <clc/math/log2.h>
diff --git a/libclc/generic/include/clc/math/fmod.h b/libclc/generic/include/clc/math/fmod.h
new file mode 100644
index 00000000000..49068675b0e
--- /dev/null
+++ b/libclc/generic/include/clc/math/fmod.h
@@ -0,0 +1,2 @@
+#define __CLC_BODY <clc/math/fmod.inc>
+#include <clc/math/gentype.inc>
diff --git a/libclc/generic/include/clc/math/fmod.inc b/libclc/generic/include/clc/math/fmod.inc
new file mode 100644
index 00000000000..39d915365c2
--- /dev/null
+++ b/libclc/generic/include/clc/math/fmod.inc
@@ -0,0 +1 @@
+_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE fmod(__CLC_GENTYPE a, __CLC_GENTYPE b);
diff --git a/libclc/generic/lib/SOURCES b/libclc/generic/lib/SOURCES
index f7b3adf6329..5918989093c 100644
--- a/libclc/generic/lib/SOURCES
+++ b/libclc/generic/lib/SOURCES
@@ -61,6 +61,7 @@ math/exp.cl
math/exp10.cl
math/fmax.cl
math/fmin.cl
+math/fmod.cl
math/hypot.cl
math/mad.cl
math/mix.cl
diff --git a/libclc/generic/lib/math/fmod.cl b/libclc/generic/lib/math/fmod.cl
new file mode 100644
index 00000000000..f9a4e317613
--- /dev/null
+++ b/libclc/generic/lib/math/fmod.cl
@@ -0,0 +1,12 @@
+#include <clc/clc.h>
+#include "../clcmacro.h"
+
+_CLC_DEFINE_BINARY_BUILTIN(float, fmod, __builtin_fmodf, float, float)
+
+#ifdef cl_khr_fp64
+
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+_CLC_DEFINE_BINARY_BUILTIN(double, fmod, __builtin_fmod, double, double)
+
+#endif
OpenPOWER on IntegriCloud