add isordered builtin

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 217247
This commit is contained in:
Jan Vesely 2014-09-05 13:59:15 +00:00
parent 63486c1f0e
commit 05a60b7ac3
4 changed files with 34 additions and 0 deletions

View File

@ -124,6 +124,7 @@
#include <clc/relational/isnan.h>
#include <clc/relational/isnormal.h>
#include <clc/relational/isnotequal.h>
#include <clc/relational/isordered.h>
#include <clc/relational/isunordered.h>
#include <clc/relational/select.h>
#include <clc/relational/signbit.h>

View File

@ -0,0 +1,9 @@
#undef isordered
#define __CLC_FUNCTION isordered
#define __CLC_BODY <clc/relational/binary_decl.inc>
#include <clc/relational/floatn.inc>
#undef __CLC_BODY
#undef __CLC_FUNCTION

View File

@ -59,6 +59,7 @@ relational/islessgreater.cl
relational/isnan.cl
relational/isnormal.cl
relational/isnotequal.cl
relational/isordered.cl
relational/isunordered.cl
relational/signbit.cl
shared/clamp.cl

View File

@ -0,0 +1,23 @@
#include <clc/clc.h>
#include "relational.h"
#define _CLC_DEFINE_ISORDERED(RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE) \
_CLC_DEF _CLC_OVERLOAD RET_TYPE FUNCTION(ARG1_TYPE x, ARG2_TYPE y) { \
return isequal(x, x) && isequal(y, y); \
} \
_CLC_DEFINE_ISORDERED(int, isordered, float, float)
_CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(int, isordered, float, float)
#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
// The scalar version of isordered(double, double) returns an int, but the vector versions
// return long.
_CLC_DEFINE_ISORDERED(int, isordered, double, double)
_CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(long, isordered, double, double)
#endif
#undef _CLC_DEFINE_ISORDERED