[Libclc-dev] [PATCH 1/1] Implement fmod
Jan Vesely
jan.vesely at rutgers.edu
Fri Sep 26 10:08:56 PDT 2014
Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---
generic/include/clc/clc.h | 1 +
generic/include/clc/math/fmod.h | 2 ++
generic/include/clc/math/fmod.inc | 1 +
generic/lib/SOURCES | 1 +
generic/lib/math/fmod.cl | 12 ++++++++++++
5 files changed, 17 insertions(+)
create mode 100644 generic/include/clc/math/fmod.h
create mode 100644 generic/include/clc/math/fmod.inc
create mode 100644 generic/lib/math/fmod.cl
diff --git a/generic/include/clc/clc.h b/generic/include/clc/clc.h
index 972255b..c39c9c8 100644
--- a/generic/include/clc/clc.h
+++ b/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/generic/include/clc/math/fmod.h b/generic/include/clc/math/fmod.h
new file mode 100644
index 0000000..4906867
--- /dev/null
+++ b/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/generic/include/clc/math/fmod.inc b/generic/include/clc/math/fmod.inc
new file mode 100644
index 0000000..39d9153
--- /dev/null
+++ b/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/generic/lib/SOURCES b/generic/lib/SOURCES
index dad283a..6f7b1e8 100644
--- a/generic/lib/SOURCES
+++ b/generic/lib/SOURCES
@@ -58,6 +58,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/generic/lib/math/fmod.cl b/generic/lib/math/fmod.cl
new file mode 100644
index 0000000..f9a4e31
--- /dev/null
+++ b/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
--
1.9.3
More information about the Libclc-dev
mailing list