Author: johannes Date: Fri Aug 24 15:59:15 2007 New Revision: 41372 URL: http://llvm.org/viewvc/llvm-project?rev=41372&view=rev Log: Use APFloat internally for ConstantFPSDNode.
Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=41372&r1=41371&r2=41372&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Fri Aug 24 15:59:15 2007 @@ -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 <cassert> @@ -1144,17 +1145,17 @@ }; 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. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=41372&r1=41371&r2=41372&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Aug 24 15:59:15 2007 @@ -49,7 +49,7 @@ /// 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); } //===----------------------------------------------------------------------===// _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits