add isfinite builtin

v2: simplify and remove isinf leftovers
    remove trailing newline

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 217243
This commit is contained in:
Jan Vesely 2014-09-05 13:59:06 +00:00
parent 163b1ba471
commit a5a3b023b4
4 changed files with 29 additions and 0 deletions

View File

@ -114,6 +114,7 @@
#include <clc/relational/any.h>
#include <clc/relational/bitselect.h>
#include <clc/relational/isequal.h>
#include <clc/relational/isfinite.h>
#include <clc/relational/isgreater.h>
#include <clc/relational/isgreaterequal.h>
#include <clc/relational/isinf.h>

View File

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

View File

@ -49,6 +49,7 @@ math/sincos_helpers.cl
relational/all.cl
relational/any.cl
relational/isequal.cl
relational/isfinite.cl
relational/isgreater.cl
relational/isgreaterequal.cl
relational/isinf.cl

View File

@ -0,0 +1,18 @@
#include <clc/clc.h>
#include "relational.h"
_CLC_DEFINE_RELATIONAL_UNARY(int, isfinite, __builtin_isfinite, float)
#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
// The scalar version of isfinite(double) returns an int, but the vector versions
// return long.
_CLC_DEF _CLC_OVERLOAD int isfinite(double x) {
return __builtin_isfinite(x);
}
_CLC_DEFINE_RELATIONAL_UNARY_VEC_ALL(long, isfinite, double)
#endif