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

Cameron McInally via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 9 09:16:52 PDT 2019


cameron.mcinally created this revision.
cameron.mcinally added reviewers: spatel, arsenm.
Herald added subscribers: llvm-commits, hiraditya, wdng.
Herald added a project: LLVM.

Repository:
  rL LLVM

https://reviews.llvm.org/D61741

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


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -11629,6 +11629,10 @@
   }
 
   // (fsub -0.0, N1) -> -N1
+  // NOTE: It is safe to xform 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 xform 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.198848.patch
Type: text/x-patch
Size: 678 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190509/5eb22bea/attachment.bin>


More information about the llvm-commits mailing list