[libclc] r214567 - relational: Add isless(floatN) builtin

Jan Vesely jan.vesely at rutgers.edu
Fri Aug 1 14:50:55 PDT 2014


Author: jvesely
Date: Fri Aug  1 16:50:55 2014
New Revision: 214567

URL: http://llvm.org/viewvc/llvm-project?rev=214567&view=rev
Log:
relational: Add isless(floatN) builtin

v2: remove the initial undef

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/isless.h
    libclc/trunk/generic/lib/relational/isless.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=214567&r1=214566&r2=214567&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Fri Aug  1 16:50:55 2014
@@ -115,6 +115,7 @@
 #include <clc/relational/isequal.h>
 #include <clc/relational/isgreater.h>
 #include <clc/relational/isgreaterequal.h>
+#include <clc/relational/isless.h>
 #include <clc/relational/isnan.h>
 #include <clc/relational/isnotequal.h>
 #include <clc/relational/select.h>

Added: libclc/trunk/generic/include/clc/relational/isless.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/relational/isless.h?rev=214567&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/relational/isless.h (added)
+++ libclc/trunk/generic/include/clc/relational/isless.h Fri Aug  1 16:50:55 2014
@@ -0,0 +1,7 @@
+#define __CLC_FUNCTION isless
+#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=214567&r1=214566&r2=214567&view=diff
==============================================================================
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Fri Aug  1 16:50:55 2014
@@ -48,6 +48,7 @@ relational/any.cl
 relational/isequal.cl
 relational/isgreater.cl
 relational/isgreaterequal.cl
+relational/isless.cl
 relational/isnan.cl
 relational/isnotequal.cl
 relational/signbit.cl

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





More information about the cfe-commits mailing list