add isnormal builtin

v2: simplify and remove isnan leftovers
    remove trailing newline

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

View File

@ -121,6 +121,7 @@
#include <clc/relational/isless.h>
#include <clc/relational/islessequal.h>
#include <clc/relational/isnan.h>
#include <clc/relational/isnormal.h>
#include <clc/relational/isnotequal.h>
#include <clc/relational/select.h>
#include <clc/relational/signbit.h>

View File

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

View File

@ -56,6 +56,7 @@ relational/isinf.cl
relational/isless.cl
relational/islessequal.cl
relational/isnan.cl
relational/isnormal.cl
relational/isnotequal.cl
relational/signbit.cl
shared/clamp.cl

View File

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