summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG
diff options
context:
space:
mode:
authorMichael Berg <michael_c_berg@apple.com>2018-06-14 18:48:31 +0000
committerMichael Berg <michael_c_berg@apple.com>2018-06-14 18:48:31 +0000
commit4663ceb63f893e3281337049d802c6fff1208ceb (patch)
tree58ebbec0dfbd163e81b64cc818510d19e1dcb172 /llvm/lib/CodeGen/SelectionDAG
parent277f898a4d155cbf79b017f163f7f6671c5acf73 (diff)
downloadbcm5719-llvm-4663ceb63f893e3281337049d802c6fff1208ceb.tar.gz
bcm5719-llvm-4663ceb63f893e3281337049d802c6fff1208ceb.zip
updating isNegatibleForFree and GetNegatedExpression with fmf for fadd
Summary: A FMF constraint is added to FADD with unsafe still available as the fallback Reviewers: spatel, wristow, arsenm, hfinkel Reviewed By: spatel Subscribers: wdng Differential Revision: https://reviews.llvm.org/D48180 llvm-svn: 334753
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index ac324fe4c3d..33821c33bb7 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -704,8 +704,8 @@ static char isNegatibleForFree(SDValue Op, bool LegalOperations,
TLI.isFPImmLegal(neg(cast<ConstantFPSDNode>(Op)->getValueAPF()), VT);
}
case ISD::FADD:
- // FIXME: determine better conditions for this xform.
- if (!Options->UnsafeFPMath) return 0;
+ if (!Options->UnsafeFPMath && !Flags.hasNoSignedZeros())
+ return 0;
// After operation legalization, it might not be legal to create new FSUBs.
if (LegalOperations && !TLI.isOperationLegalOrCustom(ISD::FSUB, VT))
@@ -766,8 +766,7 @@ static SDValue GetNegatedExpression(SDValue Op, SelectionDAG &DAG,
return DAG.getConstantFP(V, SDLoc(Op), Op.getValueType());
}
case ISD::FADD:
- // FIXME: determine better conditions for this xform.
- assert(Options.UnsafeFPMath);
+ assert(Options.UnsafeFPMath || Flags.hasNoSignedZeros());
// fold (fneg (fadd A, B)) -> (fsub (fneg A), B)
if (isNegatibleForFree(Op.getOperand(0), LegalOperations,
OpenPOWER on IntegriCloud