[PATCH] D70422: [APFloat] Fix fusedMultiplyAdd when `this` equals to `Addend`

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 19 13:20:14 PST 2019


foad added a comment.

Typo in commit message: "this `this`"



================
Comment at: llvm/lib/Support/APFloat.cpp:989
   bool ignored;
+  IEEEFloat extendedAddend(*semantics, 0);
 
----------------
Marginally more efficient to omit the `, 0` here, to use the one-argument constructor.

Since we are unconditionally constructing the addend here anyway, would it make more sense to force all callers to pass in an addend (using zero if they're not interested in it)?


================
Comment at: llvm/lib/Support/APFloat.cpp:1031
 
-  if (addend && addend->isNonZero()) {
+  if (extendedAddend.isNonZero()) {
     // The intermediate result of the multiplication has "2 * precision"
----------------
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?


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