[Beignet] [PATCH] backend: add double support to mad
rander
rander.wang at intel.com
Mon Mar 27 09:35:21 UTC 2017
Signed-off-by: rander <rander.wang at intel.com>
---
backend/src/libocl/tmpl/ocl_math.tmpl.cl | 6 +++++-
backend/src/libocl/tmpl/ocl_math.tmpl.h | 2 ++
backend/src/libocl/tmpl/ocl_math_20.tmpl.cl | 7 +++++++
backend/src/libocl/tmpl/ocl_math_20.tmpl.h | 2 +-
4 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/backend/src/libocl/tmpl/ocl_math.tmpl.cl b/backend/src/libocl/tmpl/ocl_math.tmpl.cl
index 9ab1f00..d526d6c 100644
--- a/backend/src/libocl/tmpl/ocl_math.tmpl.cl
+++ b/backend/src/libocl/tmpl/ocl_math.tmpl.cl
@@ -4009,7 +4009,6 @@ OVERLOADABLE double fract(double x, private double *p)
return x -ret;
}
-
/* @(#)e_log.c 1.3 95/01/18 */
/*
* ====================================================
@@ -4328,4 +4327,9 @@ OVERLOADABLE int ilogb(double x)
else return 0x80000000;
}
+CONST OVERLOADABLE double __gen_ocl_mad(double a, double b, double c) __asm("llvm.fma" ".f64");
+OVERLOADABLE double mad(double a, double b, double c)
+{
+ return __gen_ocl_mad(a, b, c);
+}
diff --git a/backend/src/libocl/tmpl/ocl_math.tmpl.h b/backend/src/libocl/tmpl/ocl_math.tmpl.h
index c72d7ed..852bf47 100644
--- a/backend/src/libocl/tmpl/ocl_math.tmpl.h
+++ b/backend/src/libocl/tmpl/ocl_math.tmpl.h
@@ -245,4 +245,6 @@ OVERLOADABLE double log10(double x);
OVERLOADABLE double log1p(double x);
OVERLOADABLE double logb(double x);
OVERLOADABLE int ilogb(double x);
+OVERLOADABLE double mad(double a, double b, double c);
+
diff --git a/backend/src/libocl/tmpl/ocl_math_20.tmpl.cl b/backend/src/libocl/tmpl/ocl_math_20.tmpl.cl
index 0a408ce..f459619 100644
--- a/backend/src/libocl/tmpl/ocl_math_20.tmpl.cl
+++ b/backend/src/libocl/tmpl/ocl_math_20.tmpl.cl
@@ -4204,5 +4204,12 @@ OVERLOADABLE int ilogb(double x)
else return 0x80000000;
}
+CONST OVERLOADABLE double __gen_ocl_mad(double a, double b, double c) __asm("llvm.fma" ".f64");
+OVERLOADABLE double mad(double a, double b, double c)
+{
+ return __gen_ocl_mad(a, b, c);
+}
+
+
diff --git a/backend/src/libocl/tmpl/ocl_math_20.tmpl.h b/backend/src/libocl/tmpl/ocl_math_20.tmpl.h
index 107d25c..ee313af 100644
--- a/backend/src/libocl/tmpl/ocl_math_20.tmpl.h
+++ b/backend/src/libocl/tmpl/ocl_math_20.tmpl.h
@@ -222,5 +222,5 @@ OVERLOADABLE double log10(double x);
OVERLOADABLE double log1p(double x);
OVERLOADABLE double logb(double x);
OVERLOADABLE int ilogb(double x);
-
+OVERLOADABLE double mad(double a, double b, double c);
--
2.7.4
More information about the Beignet
mailing list