[Beignet] [PATCH] backend: add convert_double_rtn(ulong)
rander
rander.wang at intel.com
Tue Mar 21 02:02:07 UTC 2017
the same as convert_double_rtz for ulong
Signed-off-by: rander <rander.wang at intel.com>
---
backend/src/libocl/script/ocl_convert.sh | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/backend/src/libocl/script/ocl_convert.sh b/backend/src/libocl/script/ocl_convert.sh
index aa3ac6c..4a1c8c7 100755
--- a/backend/src/libocl/script/ocl_convert.sh
+++ b/backend/src/libocl/script/ocl_convert.sh
@@ -1287,7 +1287,19 @@ OVERLOADABLE double convert_double_rtz(ulong x)
OVERLOADABLE double convert_double_rtn(ulong x)
{
- return 0;
+ long exp;
+ long ret, ma, tmp;
+ int msbOne = 64 -clz(x);
+ exp = msbOne + DF_EXP_BIAS - 1;
+ ret = (exp << 52);
+
+ int shift = abs(53 - msbOne);
+ tmp = ret | ((x << shift) &DF_MAN_MASK);
+ ret |= (x >> shift) &DF_MAN_MASK;
+ ret = (msbOne < 54) ? tmp:ret;
+ ret = (!msbOne) ? 0:ret;
+
+ return as_double(ret);
}
OVERLOADABLE double convert_double_rte(ulong x)
--
2.7.4
More information about the Beignet
mailing list