[libclc] 17/79: math: Implement maxmag

Andreas Boll aboll-guest at moszumanska.debian.org
Mon Mar 19 16:50:56 UTC 2018


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

aboll-guest pushed a commit to branch master
in repository libclc.

commit 60e04f47021fa22f7ff44588c5f09a15aa3a302a
Author: Jan Vesely <jan.vesely at rutgers.edu>
Date:   Wed Nov 15 04:10:37 2017 +0000

    math: Implement maxmag
    
    Reviewer: Aaron Watry
    Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
    
    git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@318264 91177308-0d34-0410-b5e6-96231b3b80d8
---
 generic/include/clc/clc.h         | 1 +
 generic/include/clc/math/maxmag.h | 7 +++++++
 generic/lib/SOURCES               | 1 +
 generic/lib/math/maxmag.cl        | 4 ++++
 generic/lib/math/maxmag.inc       | 4 ++++
 5 files changed, 17 insertions(+)

diff --git a/generic/include/clc/clc.h b/generic/include/clc/clc.h
index 5d64751..d4ab289 100644
--- a/generic/include/clc/clc.h
+++ b/generic/include/clc/clc.h
@@ -83,6 +83,7 @@
 #include <clc/math/log2.h>
 #include <clc/math/logb.h>
 #include <clc/math/mad.h>
+#include <clc/math/maxmag.h>
 #include <clc/math/modf.h>
 #include <clc/math/nextafter.h>
 #include <clc/math/pow.h>
diff --git a/generic/include/clc/math/maxmag.h b/generic/include/clc/math/maxmag.h
new file mode 100644
index 0000000..4230da9
--- /dev/null
+++ b/generic/include/clc/math/maxmag.h
@@ -0,0 +1,7 @@
+#define __CLC_BODY <clc/math/binary_decl_tt.inc>
+#define __CLC_FUNCTION maxmag
+
+#include <clc/math/gentype.inc>
+
+#undef __CLC_BODY
+#undef __CLC_FUNCTION
diff --git a/generic/lib/SOURCES b/generic/lib/SOURCES
index ad5a743..0320d29 100644
--- a/generic/lib/SOURCES
+++ b/generic/lib/SOURCES
@@ -118,6 +118,7 @@ math/log1p.cl
 math/log2.cl
 math/logb.cl
 math/mad.cl
+math/maxmag.cl
 math/modf.cl
 math/native_cos.cl
 math/native_divide.cl
diff --git a/generic/lib/math/maxmag.cl b/generic/lib/math/maxmag.cl
new file mode 100644
index 0000000..db23fc0
--- /dev/null
+++ b/generic/lib/math/maxmag.cl
@@ -0,0 +1,4 @@
+#include <clc/clc.h>
+
+#define __CLC_BODY <maxmag.inc>
+#include <clc/math/gentype.inc>
diff --git a/generic/lib/math/maxmag.inc b/generic/lib/math/maxmag.inc
new file mode 100644
index 0000000..88b0129
--- /dev/null
+++ b/generic/lib/math/maxmag.inc
@@ -0,0 +1,4 @@
+_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE maxmag(__CLC_GENTYPE x, __CLC_GENTYPE y) {
+  const __CLC_GENTYPE res = select(y, x, isgreater(fabs(x), fabs(y)));
+  return select(res, fmax(x, y), isnan(x) | isnan(y) | isequal(fabs(x), fabs(y)));
+}

-- 
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