[Beignet] [PATCH] backend: add double version of atanpi atan2pi

rander rander.wang at intel.com
Thu Mar 30 06:25:59 UTC 2017


	it is a simple implementation and need to be refined to pass cft

Signed-off-by: rander <rander.wang at intel.com>
---
 backend/src/libocl/tmpl/ocl_math_common.tmpl.cl | 10 ++++++++++
 backend/src/libocl/tmpl/ocl_math_common.tmpl.h  |  2 ++
 2 files changed, 12 insertions(+)

diff --git a/backend/src/libocl/tmpl/ocl_math_common.tmpl.cl b/backend/src/libocl/tmpl/ocl_math_common.tmpl.cl
index d1e67f4..363523d 100644
--- a/backend/src/libocl/tmpl/ocl_math_common.tmpl.cl
+++ b/backend/src/libocl/tmpl/ocl_math_common.tmpl.cl
@@ -396,6 +396,16 @@ OVERLOADABLE double atan2(double x, double y)
 	}
 }
 
+OVERLOADABLE double atanpi(double x)
+{
+	return atan(x)/M_PI;
+}
+
+OVERLOADABLE double atan2pi(double x, double y)
+{
+	return atan2(x, y)/M_PI;
+}
+
 OVERLOADABLE double ceil(double x)
 {
     double ret;
diff --git a/backend/src/libocl/tmpl/ocl_math_common.tmpl.h b/backend/src/libocl/tmpl/ocl_math_common.tmpl.h
index 2f4b85a..22c1d0d 100644
--- a/backend/src/libocl/tmpl/ocl_math_common.tmpl.h
+++ b/backend/src/libocl/tmpl/ocl_math_common.tmpl.h
@@ -28,6 +28,8 @@ OVERLOADABLE double asinpi(double x);
 OVERLOADABLE double asinh(double x);
 OVERLOADABLE double atan(double x);
 OVERLOADABLE double atan2(double x, double y);
+OVERLOADABLE double atanpi(double x);
+OVERLOADABLE double atan2pi(double x, double y);
 OVERLOADABLE double ceil(double x);
 OVERLOADABLE double copysign(double x, double y);
 OVERLOADABLE double fabs(double x);
-- 
2.7.4



More information about the Beignet mailing list