aboutsummaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2019-08-01 15:03:00 +0100
committerGeorgios Pinitas <georgios.pinitas@arm.com>2019-08-01 18:15:42 +0000
commit1c29ffc7fe02de68cf2e82709a3bc3e210cb0ba4 (patch)
treeeeeb02221fe972141f54c01d33e6ed57eb0f59df /support
parent169cda3793ce4900b2bf103739f04bb83b1b6aae (diff)
downloadComputeLibrary-1c29ffc7fe02de68cf2e82709a3bc3e210cb0ba4.tar.gz
COMPMID-2336: Fix build issues.
Change-Id: I0932dc9ca4649f0825950ed9d6d249212bc6971e Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com> Reviewed-on: https://review.mlplatform.org/c/1671 Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'support')
-rw-r--r--support/ToolchainSupport.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/support/ToolchainSupport.h b/support/ToolchainSupport.h
index 020a4a112b..03bbff9aba 100644
--- a/support/ToolchainSupport.h
+++ b/support/ToolchainSupport.h
@@ -195,6 +195,23 @@ inline T copysign(T x, T y)
return ::copysign(x, y);
}
+/** Computes (x*y) + z as if to infinite precision and rounded only once to fit the result type.
+ *
+ * @note This function implements the same behaviour as std::fma except that it doesn't
+ * support Integral type. The latter is not in the namespace std in some Android toolchains.
+ *
+ * @param[in] x floating-point value
+ * @param[in] y floating-point value
+ * @param[in] z floating-point value
+ *
+ * @return Result floating point value equal to (x*y) + z.c
+ */
+template <typename T, typename = typename std::enable_if<std::is_floating_point<T>::value>::type>
+inline T fma(T x, T y, T z)
+{
+ return ::fma(x, y, z);
+}
+
/** Loads the data from the given location, converts them to character string equivalents
* and writes the result to a character string buffer.
*
@@ -304,6 +321,23 @@ inline T copysign(T x, T y)
return std::copysign(x, y);
}
+/** Computes (x*y) + z as if to infinite precision and rounded only once to fit the result type.
+ *
+ * @note This function implements the same behaviour as std::fma except that it doesn't
+ * support Integral type. The latter is not in the namespace std in some Android toolchains.
+ *
+ * @param[in] x floating-point value
+ * @param[in] y floating-point value
+ * @param[in] z floating-point value
+ *
+ * @return Result floating point value equal to (x*y) + z.
+ */
+template <typename T, typename = typename std::enable_if<std::is_floating_point<T>::value>::type>
+inline T fma(T x, T y, T z)
+{
+ return std::fma(x, y, z);
+}
+
/** Loads the data from the given location, converts them to character string equivalents
* and writes the result to a character string buffer.
*