[PATCH] D15385: [Support] Add saturating multiply-add support function
David Li via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 9 14:29:44 PST 2015
davidxl added inline comments.
================
Comment at: include/llvm/Support/MathExtras.h:727
@@ +726,3 @@
+typename std::enable_if<std::is_unsigned<T>::value, T>::type
+SaturatingMultiplyAdd(T X, T Y, T A, bool *ResultOverflowed = nullptr) {
+ bool Dummy;
----------------
Do we want types of X and Y to be same ? For instance, the weight can be less than 1.
Also we may want to have an overloaded function that is used for common cases where one of the X or Y is constant:
template <typename T, uint64_t Multiplier>
typename std::enable_if<std::is_unsigned<T>::value, T>::type SaturatingMultiplyAdd(T X, T A, bool *ResultOverflowed = nullptr) {
...
}
it is probably just slightly more efficient so probably not in this patch.
http://reviews.llvm.org/D15385
More information about the llvm-commits
mailing list