[libclc] 47/291: libclc: Add max() builtin function

Andreas Beckmann anbe at moszumanska.debian.org
Tue Sep 8 10:53:32 UTC 2015


This is an automated email from the git hooks/post-receive script.

anbe pushed a commit to branch master
in repository libclc.

commit 485cf99dbb8ef2e08c3a7d5c970a556546df73a6
Author: Tom Stellard <thomas.stellard at amd.com>
Date:   Wed Jun 26 18:20:46 2013 +0000

    libclc: Add max() builtin function
    
    Adds this function for both int and floating data types.
    
    Patch by: Aaron Watry
    
    git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@184992 91177308-0d34-0410-b5e6-96231b3b80d8
---
 generic/include/clc/clc.h           | 2 ++
 generic/include/clc/integer/max.h   | 2 ++
 generic/include/clc/integer/max.inc | 1 +
 generic/include/clc/math/max.h      | 2 ++
 generic/include/clc/math/max.inc    | 1 +
 generic/lib/SOURCES                 | 2 ++
 generic/lib/integer/max.cl          | 4 ++++
 generic/lib/integer/max.inc         | 3 +++
 generic/lib/math/max.cl             | 8 ++++++++
 generic/lib/math/max.inc            | 3 +++
 10 files changed, 28 insertions(+)

diff --git a/generic/include/clc/clc.h b/generic/include/clc/clc.h
index 4394c9e..f6668a3 100644
--- a/generic/include/clc/clc.h
+++ b/generic/include/clc/clc.h
@@ -45,6 +45,7 @@
 #include <clc/math/log.h>
 #include <clc/math/log2.h>
 #include <clc/math/mad.h>
+#include <clc/math/max.h>
 #include <clc/math/pow.h>
 #include <clc/math/sin.h>
 #include <clc/math/sqrt.h>
@@ -63,6 +64,7 @@
 #include <clc/integer/abs.h>
 #include <clc/integer/abs_diff.h>
 #include <clc/integer/add_sat.h>
+#include <clc/integer/max.h>
 #include <clc/integer/sub_sat.h>
 
 /* 6.11.5 Geometric Functions */
diff --git a/generic/include/clc/integer/max.h b/generic/include/clc/integer/max.h
new file mode 100644
index 0000000..e74a459
--- /dev/null
+++ b/generic/include/clc/integer/max.h
@@ -0,0 +1,2 @@
+#define BODY <clc/integer/max.inc>
+#include <clc/integer/gentype.inc>
diff --git a/generic/include/clc/integer/max.inc b/generic/include/clc/integer/max.inc
new file mode 100644
index 0000000..ce6c6d0
--- /dev/null
+++ b/generic/include/clc/integer/max.inc
@@ -0,0 +1 @@
+_CLC_OVERLOAD _CLC_DECL GENTYPE max(GENTYPE a, GENTYPE b);
diff --git a/generic/include/clc/math/max.h b/generic/include/clc/math/max.h
new file mode 100644
index 0000000..3d158f1
--- /dev/null
+++ b/generic/include/clc/math/max.h
@@ -0,0 +1,2 @@
+#define BODY <clc/math/max.inc>
+#include <clc/math/gentype.inc>
diff --git a/generic/include/clc/math/max.inc b/generic/include/clc/math/max.inc
new file mode 100644
index 0000000..ce6c6d0
--- /dev/null
+++ b/generic/include/clc/math/max.inc
@@ -0,0 +1 @@
+_CLC_OVERLOAD _CLC_DECL GENTYPE max(GENTYPE a, GENTYPE b);
diff --git a/generic/lib/SOURCES b/generic/lib/SOURCES
index 86c008b..b593941 100644
--- a/generic/lib/SOURCES
+++ b/generic/lib/SOURCES
@@ -7,6 +7,7 @@ integer/abs.cl
 integer/add_sat.cl
 integer/add_sat.ll
 integer/add_sat_impl.ll
+integer/max.cl
 integer/sub_sat.cl
 integer/sub_sat.ll
 integer/sub_sat_impl.ll
@@ -14,6 +15,7 @@ math/fmax.cl
 math/fmin.cl
 math/hypot.cl
 math/mad.cl
+math/max.cl
 relational/any.cl
 workitem/get_global_id.cl
 workitem/get_global_size.cl
diff --git a/generic/lib/integer/max.cl b/generic/lib/integer/max.cl
new file mode 100644
index 0000000..89fec7c
--- /dev/null
+++ b/generic/lib/integer/max.cl
@@ -0,0 +1,4 @@
+#include <clc/clc.h>
+
+#define BODY <max.inc>
+#include <clc/integer/gentype.inc>
diff --git a/generic/lib/integer/max.inc b/generic/lib/integer/max.inc
new file mode 100644
index 0000000..37409fc
--- /dev/null
+++ b/generic/lib/integer/max.inc
@@ -0,0 +1,3 @@
+_CLC_OVERLOAD _CLC_DEF GENTYPE max(GENTYPE a, GENTYPE b) {
+  return (a > b ? a : b);
+}
diff --git a/generic/lib/math/max.cl b/generic/lib/math/max.cl
new file mode 100644
index 0000000..d1254a7
--- /dev/null
+++ b/generic/lib/math/max.cl
@@ -0,0 +1,8 @@
+#include <clc/clc.h>
+
+#ifdef cl_khr_fp64
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+#endif
+
+#define BODY <max.inc>
+#include <clc/math/gentype.inc>
diff --git a/generic/lib/math/max.inc b/generic/lib/math/max.inc
new file mode 100644
index 0000000..37409fc
--- /dev/null
+++ b/generic/lib/math/max.inc
@@ -0,0 +1,3 @@
+_CLC_OVERLOAD _CLC_DEF GENTYPE max(GENTYPE a, GENTYPE b) {
+  return (a > b ? a : b);
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/libclc.git



More information about the Pkg-opencl-commits mailing list