[libclc] 160/291: relational: Implement isgreater

Andreas Beckmann anbe at moszumanska.debian.org
Tue Sep 8 10:53:45 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 3ce0451984a4f7ebdf04e2464d36d06cc98975d4
Author: Aaron Watry <awatry at gmail.com>
Date:   Thu Jul 17 22:07:19 2014 +0000

    relational: Implement isgreater
    
    v2: Use relational macros instead of hand-rolled macros
    
    Signed-off-by: Aaron Watry <awatry at gmail.com>
    Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
    
    git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@213318 91177308-0d34-0410-b5e6-96231b3b80d8
---
 generic/include/clc/clc.h                  |  1 +
 generic/include/clc/relational/isgreater.h |  9 +++++++++
 generic/lib/SOURCES                        |  1 +
 generic/lib/relational/isgreater.cl        | 22 ++++++++++++++++++++++
 4 files changed, 33 insertions(+)

diff --git a/generic/include/clc/clc.h b/generic/include/clc/clc.h
index 96e090b..34123d9 100644
--- a/generic/include/clc/clc.h
+++ b/generic/include/clc/clc.h
@@ -110,6 +110,7 @@
 #include <clc/relational/any.h>
 #include <clc/relational/bitselect.h>
 #include <clc/relational/isequal.h>
+#include <clc/relational/isgreater.h>
 #include <clc/relational/isnan.h>
 #include <clc/relational/select.h>
 #include <clc/relational/signbit.h>
diff --git a/generic/include/clc/relational/isgreater.h b/generic/include/clc/relational/isgreater.h
new file mode 100644
index 0000000..d17ae0c
--- /dev/null
+++ b/generic/include/clc/relational/isgreater.h
@@ -0,0 +1,9 @@
+#undef isgreater
+
+#define __CLC_FUNCTION isgreater
+#define __CLC_BODY <clc/relational/binary_decl.inc>
+
+#include <clc/relational/floatn.inc>
+
+#undef __CLC_BODY
+#undef __CLC_FUNCTION
diff --git a/generic/lib/SOURCES b/generic/lib/SOURCES
index a6d16bd..671fff2 100644
--- a/generic/lib/SOURCES
+++ b/generic/lib/SOURCES
@@ -41,6 +41,7 @@ math/sincos.cl
 relational/all.cl
 relational/any.cl
 relational/isequal.cl
+relational/isgreater.cl
 relational/isnan.cl
 relational/signbit.cl
 shared/clamp.cl
diff --git a/generic/lib/relational/isgreater.cl b/generic/lib/relational/isgreater.cl
new file mode 100644
index 0000000..79456e5
--- /dev/null
+++ b/generic/lib/relational/isgreater.cl
@@ -0,0 +1,22 @@
+#include <clc/clc.h>
+#include "relational.h"
+
+//Note: It would be nice to use __builtin_isgreater with vector inputs, but it seems to only take scalar values as
+//      input, which will produce incorrect output for vector input types.
+
+_CLC_DEFINE_RELATIONAL_BINARY(int, isgreater, __builtin_isgreater, float, float)
+
+#ifdef cl_khr_fp64
+
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+// The scalar version of isgreater(double, double) returns an int, but the vector versions
+// return long.
+
+_CLC_DEF _CLC_OVERLOAD int isgreater(double x, double y){
+	return __builtin_isgreater(x, y);
+}
+
+_CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(long, isgreater, double, double)
+
+#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