From 4cbac756666d810075b9f7ac028564da851f6f30 Mon Sep 17 00:00:00 2001 From: Cameron McInally Date: Thu, 9 May 2019 19:28:52 +0000 Subject: [PATCH] [CodeGen] Add comment about FSUB <-> FNEG xforms Differential Revision: https://reviews.llvm.org/D61741 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360366 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 4c9e34b533e..59f7af01e8b 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -11629,6 +11629,10 @@ SDValue DAGCombiner::visitFSUB(SDNode *N) { } // (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())) { -- 2.50.1