[libclc] r217245 - add islessgreater builtin

Jan Vesely jan.vesely at rutgers.edu
Fri Sep 5 06:59:11 PDT 2014


Author: jvesely
Date: Fri Sep  5 08:59:11 2014
New Revision: 217245

URL: http://llvm.org/viewvc/llvm-project?rev=217245&view=rev
Log:
add islessgreater builtin

v2: remove trailing newline

Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
Reviewed-by: Aaron Watry <awatry at gmail.com>

Added:
    libclc/trunk/generic/include/clc/relational/islessgreater.h
    libclc/trunk/generic/lib/relational/islessgreater.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=217245&r1=217244&r2=217245&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Fri Sep  5 08:59:11 2014
@@ -120,6 +120,7 @@
 #include <clc/relational/isinf.h>
 #include <clc/relational/isless.h>
 #include <clc/relational/islessequal.h>
+#include <clc/relational/islessgreater.h>
 #include <clc/relational/isnan.h>
 #include <clc/relational/isnormal.h>
 #include <clc/relational/isnotequal.h>

Added: libclc/trunk/generic/include/clc/relational/islessgreater.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/relational/islessgreater.h?rev=217245&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/relational/islessgreater.h (added)
+++ libclc/trunk/generic/include/clc/relational/islessgreater.h Fri Sep  5 08:59:11 2014
@@ -0,0 +1,7 @@
+#define __CLC_FUNCTION islessgreater
+#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=217245&r1=217244&r2=217245&view=diff
==============================================================================
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Fri Sep  5 08:59:11 2014
@@ -55,6 +55,7 @@ relational/isgreaterequal.cl
 relational/isinf.cl
 relational/isless.cl
 relational/islessequal.cl
+relational/islessgreater.cl
 relational/isnan.cl
 relational/isnormal.cl
 relational/isnotequal.cl

Added: libclc/trunk/generic/lib/relational/islessgreater.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/relational/islessgreater.cl?rev=217245&view=auto
==============================================================================
--- libclc/trunk/generic/lib/relational/islessgreater.cl (added)
+++ libclc/trunk/generic/lib/relational/islessgreater.cl Fri Sep  5 08:59:11 2014
@@ -0,0 +1,22 @@
+#include <clc/clc.h>
+#include "relational.h"
+
+//Note: It would be nice to use __builtin_islessgreater 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, islessgreater, __builtin_islessgreater, float, float)
+
+#ifdef cl_khr_fp64
+
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+// The scalar version of islessgreater(double, double) returns an int, but the vector versions
+// return long.
+
+_CLC_DEF _CLC_OVERLOAD int islessgreater(double x, double y){
+	return __builtin_islessgreater(x, y);
+}
+
+_CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(long, islessgreater, double, double)
+
+#endif





More information about the cfe-commits mailing list