[libclc] 65/79: minmag: Condition variable needs to be the same bitwidth as operands

Andreas Boll aboll-guest at moszumanska.debian.org
Mon Mar 19 16:51:01 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 8e7fa642b670eee0a9743515e78a302631153ed5
Author: Jan Vesely <jan.vesely at rutgers.edu>
Date:   Tue Mar 6 17:48:40 2018 +0000

    minmag: Condition variable needs to be the same bitwidth as operands
    
    No changes wrt CTS
    
    Reviewed-by: Aaron Watry <awatry at gmail.com>
    Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
    
    git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@326818 91177308-0d34-0410-b5e6-96231b3b80d8
---
 generic/lib/math/minmag.cl  |  1 +
 generic/lib/math/minmag.inc | 22 ++++++++++++++++++++--
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/generic/lib/math/minmag.cl b/generic/lib/math/minmag.cl
index 1c815fc..0d89882 100644
--- a/generic/lib/math/minmag.cl
+++ b/generic/lib/math/minmag.cl
@@ -1,4 +1,5 @@
 #include <clc/clc.h>
+#include <utils.h>
 
 #define __CLC_BODY <minmag.inc>
 #include <clc/math/gentype.inc>
diff --git a/generic/lib/math/minmag.inc b/generic/lib/math/minmag.inc
index 097822c..f8072aa 100644
--- a/generic/lib/math/minmag.inc
+++ b/generic/lib/math/minmag.inc
@@ -1,4 +1,22 @@
+#ifdef __CLC_SCALAR
+#define __CLC_VECSIZE
+#endif
+
+#if __CLC_FPSIZE == 64
+#define __CLC_CONVERT_NATN __CLC_XCONCAT(convert_long, __CLC_VECSIZE)
+#elif __CLC_FPSIZE == 32
+#define __CLC_CONVERT_NATN __CLC_XCONCAT(convert_int, __CLC_VECSIZE)
+#elif __CLC_FPSIZE == 16
+#define __CLC_CONVERT_NATN __CLC_XCONCAT(convert_short, __CLC_VECSIZE)
+#endif
+
 _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE minmag(__CLC_GENTYPE x, __CLC_GENTYPE y) {
-  const __CLC_GENTYPE res = select(y, x, isless(fabs(x), fabs(y)));
-  return select(res, fmin(x, y), isnan(x) | isnan(y) | isequal(fabs(x), fabs(y)));
+  const __CLC_GENTYPE res = select(y, x, __CLC_CONVERT_NATN(isless(fabs(x), fabs(y))));
+  return select(res, fmin(x, y), __CLC_CONVERT_NATN(isnan(x) | isnan(y) | isequal(fabs(x), fabs(y))));
 }
+
+#undef __CLC_CONVERT_NATN
+
+#ifdef __CLC_SCALAR
+#undef __CLC_VECSIZE
+#endif

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