[libclc] r217246 - add isunordered builtin
Jan Vesely
jan.vesely at rutgers.edu
Fri Sep 5 06:59:13 PDT 2014
Author: jvesely
Date: Fri Sep 5 08:59:13 2014
New Revision: 217246
URL: http://llvm.org/viewvc/llvm-project?rev=217246&view=rev
Log:
add isunordered 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/isunordered.h
libclc/trunk/generic/lib/relational/isunordered.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=217246&r1=217245&r2=217246&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Fri Sep 5 08:59:13 2014
@@ -124,6 +124,7 @@
#include <clc/relational/isnan.h>
#include <clc/relational/isnormal.h>
#include <clc/relational/isnotequal.h>
+#include <clc/relational/isunordered.h>
#include <clc/relational/select.h>
#include <clc/relational/signbit.h>
Added: libclc/trunk/generic/include/clc/relational/isunordered.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/relational/isunordered.h?rev=217246&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/relational/isunordered.h (added)
+++ libclc/trunk/generic/include/clc/relational/isunordered.h Fri Sep 5 08:59:13 2014
@@ -0,0 +1,9 @@
+#undef isunordered
+
+#define __CLC_FUNCTION isunordered
+#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=217246&r1=217245&r2=217246&view=diff
==============================================================================
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Fri Sep 5 08:59:13 2014
@@ -59,6 +59,7 @@ relational/islessgreater.cl
relational/isnan.cl
relational/isnormal.cl
relational/isnotequal.cl
+relational/isunordered.cl
relational/signbit.cl
shared/clamp.cl
shared/max.cl
Added: libclc/trunk/generic/lib/relational/isunordered.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/relational/isunordered.cl?rev=217246&view=auto
==============================================================================
--- libclc/trunk/generic/lib/relational/isunordered.cl (added)
+++ libclc/trunk/generic/lib/relational/isunordered.cl Fri Sep 5 08:59:13 2014
@@ -0,0 +1,22 @@
+#include <clc/clc.h>
+#include "relational.h"
+
+//Note: It would be nice to use __builtin_isunordered 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, isunordered, __builtin_isunordered, float, float)
+
+#ifdef cl_khr_fp64
+
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+// The scalar version of isunordered(double, double) returns an int, but the vector versions
+// return long.
+
+_CLC_DEF _CLC_OVERLOAD int isunordered(double x, double y){
+ return __builtin_isunordered(x, y);
+}
+
+_CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(long, isunordered, double, double)
+
+#endif
More information about the cfe-commits
mailing list