[Beignet] [PATCH 1/2] add builtin function "remquo"
Yang, Rong R
rong.r.yang at intel.com
Wed Jul 17 01:14:52 PDT 2013
Hi, Homer,
Per spec, remquo's return value maybe -0.f case, and quo is only the lower seven bits of the
integral quotient x/y. Do you handle them?
-----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, July 17, 2013 12:49 PM
To: beignet at lists.freedesktop.org
Subject: [Beignet] [PATCH 1/2] add builtin function "remquo"
Signed-off-by: Homer Hsing <homer.xing at intel.com>
---
backend/src/ocl_stdlib.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/backend/src/ocl_stdlib.h b/backend/src/ocl_stdlib.h index cfe62d6..893b967 100644
--- a/backend/src/ocl_stdlib.h
+++ b/backend/src/ocl_stdlib.h
@@ -5342,6 +5342,14 @@ INLINE_OVERLOADABLE float16 fract(float16 x, float16 *p) {
fract(x.se, 14 + (float *)p),
fract(x.sf, 15 + (float *)p)); }
+INLINE_OVERLOADABLE float remquo(float x, float y, int *quo) {
+ uint hx = as_uint(x), ix = hx & 0x7FFFFFFF, hy = as_uint(y), iy = hy
+& 0x7FFFFFFF;
+ if (ix > 0x7F800000 || iy > 0x7F800000 || ix == 0x7F800000 || iy == 0)
+ return nan(0u);
+ float k = x / y;
+ *quo = __gen_ocl_rnde(k);
+ return x - (*quo) * y;
+}
INLINE_OVERLOADABLE float native_divide(float x, float y) { return x/y; } INLINE_OVERLOADABLE float ldexp(float x, int n) {
return __gen_ocl_pow(2, n) * x;
--
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