1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

make ConstantFP::isExactlyValue work for long double as well.

llvm-svn: 49410
This commit is contained in:
Chris Lattner 2008-04-09 00:03:58 +00:00
parent f08f0a6de6
commit 6e11e1a381

View File

@ -251,16 +251,13 @@ public:
/// As such, this method can be used to do an exact bit-for-bit comparison of
/// two floating point values. The version with a double operand is retained
/// because it's so convenient to write isExactlyValue(2.0), but please use
/// it only for constants.
/// it only for simple constants.
bool isExactlyValue(const APFloat& V) const;
bool isExactlyValue(double V) const {
if (&Val.getSemantics() == &APFloat::IEEEdouble)
return isExactlyValue(APFloat(V));
else if (&Val.getSemantics() == &APFloat::IEEEsingle)
return isExactlyValue(APFloat((float)V));
assert(0);
return false;
APFloat FV(V);
FV.convert(Val.getSemantics(), APFloat::rmNearestTiesToEven);
return isExactlyValue(FV);
}
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstantFP *) { return true; }