[Beignet] [PATCH] fix isnan (builtin function)
Xing, Homer
homer.xing at intel.com
Wed Oct 9 19:26:47 PDT 2013
Sure. After I finish those lots of builtin function "convert_DSTTYPE_sat_ROUNDING".
-----Original Message-----
From: Yang, Rong R
Sent: Thursday, October 10, 2013 10:24 AM
To: Xing, Homer; beignet at lists.freedesktop.org
Subject: RE: [Beignet] [PATCH] fix isnan (builtin function)
LGTM, test pass.
BTW: can you implement the other __builtin_xxx function too?
-----Original Message-----
From: beignet-bounces+rong.r.yang=intel.com at lists.freedesktop.org [mailto:beignet-bounces+rong.r.yang=intel.com at lists.freedesktop.org] On Behalf Of Homer Hsing
Sent: Wednesday, October 09, 2013 4:15 PM
To: beignet at lists.freedesktop.org
Subject: [Beignet] [PATCH] fix isnan (builtin function)
this patch passes following piglit test case
piglit/framework/../bin/cl-program-tester generated_tests/cl/builtin/relational/builtin-float-isnan-1.0.generated.cl
Signed-off-by: Homer Hsing <homer.xing at intel.com>
---
backend/src/ocl_stdlib.tmpl.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/backend/src/ocl_stdlib.tmpl.h b/backend/src/ocl_stdlib.tmpl.h index 8dfea09..831a658 100644
--- a/backend/src/ocl_stdlib.tmpl.h
+++ b/backend/src/ocl_stdlib.tmpl.h
@@ -246,7 +246,11 @@ DEF(uint, float);
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 isnan(float x) {
+ union { uint u; float f; } u;
+ u.f = x;
+ return (u.u & 0x7FFFFFFF) > 0x7F800000; }
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); }
--
1.8.1.2
_______________________________________________
Beignet mailing list
Beignet at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list