From: Dale Johannesen Date: Fri, 24 Aug 2007 20:59:15 +0000 (+0000) Subject: Use APFloat internally for ConstantFPSDNode. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8bb369b8072c919ef5802f639a52b17620201190;p=oota-llvm.git Use APFloat internally for ConstantFPSDNode. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41372 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h index b0278cbc5be..9068d780996 100644 --- a/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/include/llvm/CodeGen/SelectionDAGNodes.h @@ -23,6 +23,7 @@ #include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/GraphTraits.h" #include "llvm/ADT/iterator" +#include "llvm/ADT/APFloat.h" #include "llvm/CodeGen/ValueTypes.h" #include "llvm/Support/DataTypes.h" #include @@ -1144,17 +1145,17 @@ public: }; class ConstantFPSDNode : public SDNode { - double Value; + APFloat Value; virtual void ANCHOR(); // Out-of-line virtual method to give class a home. protected: friend class SelectionDAG; ConstantFPSDNode(bool isTarget, double val, MVT::ValueType VT) : SDNode(isTarget ? ISD::TargetConstantFP : ISD::ConstantFP, - getSDVTList(VT)), Value(val) { + getSDVTList(VT)), Value(APFloat(val)) { } public: - double getValue() const { return Value; } + double getValue() const { return Value.convertToDouble(); } /// isExactlyValue - We don't rely on operator== working on double values, as /// it returns true for things that are clearly not equal, like -0.0 and 0.0. diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 7ac8ea81aa6..10ffdc42b15 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -49,7 +49,7 @@ static SDVTList makeVTList(const MVT::ValueType *VTs, unsigned NumVTs) { /// As such, this method can be used to do an exact bit-for-bit comparison of /// two floating point values. bool ConstantFPSDNode::isExactlyValue(double V) const { - return DoubleToBits(V) == DoubleToBits(Value); + return Value == APFloat(V); } //===----------------------------------------------------------------------===//