add islessgreater builtin

v2: remove trailing newline

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 217245
This commit is contained in:
Jan Vesely 2014-09-05 13:59:11 +00:00
parent 369e20353c
commit 41a0c491de
4 changed files with 31 additions and 0 deletions

View File

@ -120,6 +120,7 @@
#include <clc/relational/isinf.h> #include <clc/relational/isinf.h>
#include <clc/relational/isless.h> #include <clc/relational/isless.h>
#include <clc/relational/islessequal.h> #include <clc/relational/islessequal.h>
#include <clc/relational/islessgreater.h>
#include <clc/relational/isnan.h> #include <clc/relational/isnan.h>
#include <clc/relational/isnormal.h> #include <clc/relational/isnormal.h>
#include <clc/relational/isnotequal.h> #include <clc/relational/isnotequal.h>

View File

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

View File

@ -55,6 +55,7 @@ relational/isgreaterequal.cl
relational/isinf.cl relational/isinf.cl
relational/isless.cl relational/isless.cl
relational/islessequal.cl relational/islessequal.cl
relational/islessgreater.cl
relational/isnan.cl relational/isnan.cl
relational/isnormal.cl relational/isnormal.cl
relational/isnotequal.cl relational/isnotequal.cl

View File

@ -0,0 +1,22 @@
#include <clc/clc.h>
#include "relational.h"
//Note: It would be nice to use __builtin_islessgreater 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, islessgreater, __builtin_islessgreater, float, float)
#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
// The scalar version of islessgreater(double, double) returns an int, but the vector versions
// return long.
_CLC_DEF _CLC_OVERLOAD int islessgreater(double x, double y){
return __builtin_islessgreater(x, y);
}
_CLC_DEFINE_RELATIONAL_BINARY_VEC_ALL(long, islessgreater, double, double)
#endif