[PATCH] D70422: [APFloat] Fix fusedMultiplyAdd when `this` equals to `Addend`
Ehud Katz via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 22 11:31:29 PST 2019
ekatz marked an inline comment as done.
ekatz added inline comments.
================
Comment at: llvm/lib/Support/APFloat.cpp:1031
- if (addend && addend->isNonZero()) {
+ if (extendedAddend.isNonZero()) {
// The intermediate result of the multiplication has "2 * precision"
----------------
foad wrote:
> ekatz wrote:
> > foad wrote:
> > > Is it safe to skip this code when the addend is zero? If the result of the multiply is also zero, adding zero could affect the sign of the result, couldn't it?
> > Good observation, but adding/subtracting a negative zero, doesn't affect the sign (it is considered the same as positive zero).
> A couple of cases where adding zero changes the sign, accoerding to the comment at the end of IEEEFloat::addOrSubtract:
> -0 + +0 = +0 (except if rounding to -inf)
> +0 + -0 = -0 (if rounding to -inf)
> (I realise this code is pre-existing, so no need to address it as part of the current patch.)
Good catch! Those corner cases never end...
I'll open a new bug for it.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70422/new/
https://reviews.llvm.org/D70422
More information about the llvm-commits
mailing list