forked from OSchip/llvm-project
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:
parent
a5a3b023b4
commit
369e20353c
|
@ -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>
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue