[libclc] r213319 - relational: Implement isgreaterequal
Aaron Watry
awatry at gmail.com
Thu Jul 17 15:07:27 PDT 2014
Author: awatry
Date: Thu Jul 17 17:07:27 2014
New Revision: 213319
URL: http://llvm.org/viewvc/llvm-project?rev=213319&view=rev
Log:
relational: Implement isgreaterequal
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>
Added:
libclc/trunk/generic/include/clc/relational/isgreaterequal.h
libclc/trunk/generic/lib/relational/isgreaterequal.cl
Modified:
libclc/trunk/generic/include/clc/clc.h
libclc/trunk/generic/lib/SOURCES
Modified: libclc/trunk/generic/include/clc/clc.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=213319&r1=213318&r2=213319&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Thu Jul 17 17:07:27 2014
@@ -111,6 +111,7 @@
#include <clc/relational/bitselect.h>
#include <clc/relational/isequal.h>
#include <clc/relational/isgreater.h>
+#include <clc/relational/isgreaterequal.h>
#include <clc/relational/isnan.h>
#include <clc/relational/select.h>
#include <clc/relational/signbit.h>
Added: libclc/trunk/generic/include/clc/relational/isgreaterequal.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/relational/isgreaterequal.h?rev=213319&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/relational/isgreaterequal.h (added)
+++ libclc/trunk/generic/include/clc/relational/isgreaterequal.h Thu Jul 17 17:07:27 2014
@@ -0,0 +1,9 @@
+#undef isgreaterequal
+
+#define __CLC_FUNCTION isgreaterequal
+#define __CLC_BODY <clc/relational/binary_decl.inc>
+
+#include <clc/relational/floatn.inc>
+
+#undef __CLC_BODY
+#undef __CLC_FUNCTION
Modified: libclc/trunk/generic/lib/SOURCES
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=213319&r1=213318&r2=213319&view=diff
==============================================================================
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Thu Jul 17 17:07:27 2014
@@ -42,6 +42,7 @@ relational/all.cl
relational/any.cl
relational/isequal.cl
relational/isgreater.cl
+relational/isgreaterequal.cl
relational/isnan.cl
relational/signbit.cl
shared/clamp.cl
Added: libclc/trunk/generic/lib/relational/isgreaterequal.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/relational/isgreaterequal.cl?rev=213319&view=auto
==============================================================================
--- libclc/trunk/generic/lib/relational/isgreaterequal.cl (added)
+++ libclc/trunk/generic/lib/relational/isgreaterequal.cl Thu Jul 17 17:07:27 2014
@@ -0,0 +1,22 @@
+#include <clc/clc.h>
+#include "relational.h"
+
+//Note: It would be nice to use __builtin_isgreaterequal 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, isgreaterequal, __builtin_isgreaterequal, float, float)
+
+#ifdef cl_khr_fp64
+
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+// The scalar version of isgreaterequal(double, double) returns an int, but the vector versions
+// return long.
+
+_CLC_DEF _CLC_OVERLOAD int isgreaterequal(double x, double y){
+ return __builtin_isgreaterequal(x, y);
+}
+
+_CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(long, isgreaterequal, double, double)
+
+#endif
More information about the cfe-commits
mailing list