relational: Implement isnotequal

v2: Use relational macros instead of hand-rolled ones

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 213320
This commit is contained in:
Aaron Watry 2014-07-17 22:07:32 +00:00
parent 30102536c0
commit d7f022a582
4 changed files with 34 additions and 0 deletions

View File

@ -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>

View File

@ -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

View File

@ -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

View File

@ -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