[libclc] r213320 - relational: Implement isnotequal

Aaron Watry awatry at gmail.com
Thu Jul 17 15:07:32 PDT 2014


Author: awatry
Date: Thu Jul 17 17:07:32 2014
New Revision: 213320

URL: http://llvm.org/viewvc/llvm-project?rev=213320&view=rev
Log:
relational: Implement isnotequal

v2: Use relational macros instead of hand-rolled ones

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/isnotequal.h
    libclc/trunk/generic/lib/relational/isnotequal.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=213320&r1=213319&r2=213320&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Thu Jul 17 17:07:32 2014
@@ -113,6 +113,7 @@
 #include <clc/relational/isgreater.h>
 #include <clc/relational/isgreaterequal.h>
 #include <clc/relational/isnan.h>
+#include <clc/relational/isnotequal.h>
 #include <clc/relational/select.h>
 #include <clc/relational/signbit.h>
 

Added: libclc/trunk/generic/include/clc/relational/isnotequal.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/relational/isnotequal.h?rev=213320&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/relational/isnotequal.h (added)
+++ libclc/trunk/generic/include/clc/relational/isnotequal.h Thu Jul 17 17:07:32 2014
@@ -0,0 +1,9 @@
+#undef isnotequal
+
+#define __CLC_FUNCTION isnotequal
+#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=213320&r1=213319&r2=213320&view=diff
==============================================================================
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Thu Jul 17 17:07:32 2014
@@ -44,6 +44,7 @@ relational/isequal.cl
 relational/isgreater.cl
 relational/isgreaterequal.cl
 relational/isnan.cl
+relational/isnotequal.cl
 relational/signbit.cl
 shared/clamp.cl
 shared/max.cl

Added: libclc/trunk/generic/lib/relational/isnotequal.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/relational/isnotequal.cl?rev=213320&view=auto
==============================================================================
--- libclc/trunk/generic/lib/relational/isnotequal.cl (added)
+++ libclc/trunk/generic/lib/relational/isnotequal.cl Thu Jul 17 17:07:32 2014
@@ -0,0 +1,23 @@
+#include <clc/clc.h>
+#include "relational.h"
+
+#define _CLC_DEFINE_ISNOTEQUAL(RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE) \
+_CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG1_TYPE x, ARG2_TYPE y) { \
+  return (x != y); \
+} \
+
+_CLC_DEFINE_ISNOTEQUAL(int, isnotequal, float, float)
+_CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(int, isnotequal, float, float)
+
+#ifdef cl_khr_fp64
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+// The scalar version of isnotequal(double, double) returns an int, but the vector versions
+// return long.
+
+_CLC_DEFINE_ISNOTEQUAL(int, isnotequal, double, double)
+_CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(long, isnotequal, double, double)
+
+#endif
+
+#undef _CLC_DEFINE_ISNOTEQUAL





More information about the cfe-commits mailing list