[Beignet] [PATCH] add built-in function "isordered", "isunordered"

Homer Hsing homer.xing at intel.com
Sun Jul 28 19:25:18 PDT 2013


Signed-off-by: Homer Hsing <homer.xing at intel.com>
---
 backend/src/ocl_stdlib.tmpl.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/backend/src/ocl_stdlib.tmpl.h b/backend/src/ocl_stdlib.tmpl.h
index 003eedc..0a3ebf6 100644
--- a/backend/src/ocl_stdlib.tmpl.h
+++ b/backend/src/ocl_stdlib.tmpl.h
@@ -204,6 +204,8 @@ INLINE_OVERLOADABLE int isfinite(float x) { return __builtin_isfinite(x); }
 INLINE_OVERLOADABLE int isinf(float x) { return __builtin_isinf(x); }
 INLINE_OVERLOADABLE int isnan(float x) { return __builtin_isnan(x); }
 INLINE_OVERLOADABLE int isnormal(float x) { return __builtin_isnormal(x); }
+INLINE_OVERLOADABLE int isordered(float x, float y) { return isequal(x, x) && isequal(y, y); }
+INLINE_OVERLOADABLE int isunordered(float x, float y) { return isnan(x) || isnan(y); }
 INLINE_OVERLOADABLE int signbit(float x) { return __builtin_signbit(x); }
 
 #define DEC1(type) INLINE_OVERLOADABLE int any(type a) { return a<0; }
-- 
1.8.1.2



More information about the Beignet mailing list