[PATCH] D61741: Add comment about FSUB(-0.0,X) <--> FNEG(X) transforms

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 9 12:28:00 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL360366: [CodeGen] Add comment about FSUB <-> FNEG xforms (authored by mcinally, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D61741?vs=198848&id=198887#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61741/new/

https://reviews.llvm.org/D61741

Files:
  llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp


Index: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -11629,6 +11629,10 @@
   }
 
   // (fsub -0.0, N1) -> -N1
+  // NOTE: It is safe to transform an FSUB(-0.0,X) into an FNEG(X), since the
+  //       FSUB does not specify the sign bit of a NaN. Also note that for
+  //       the same reason, the inverse transform is not safe, unless fast math
+  //       flags are in play.
   if (N0CFP && N0CFP->isZero()) {
     if (N0CFP->isNegative() ||
         (Options.NoSignedZerosFPMath || Flags.hasNoSignedZeros())) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61741.198887.patch
Type: text/x-patch
Size: 704 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190509/a5175a52/attachment.bin>


More information about the llvm-commits mailing list