diff options
| author | Chris Lattner <sabre@nondot.org> | 2008-04-09 00:03:58 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2008-04-09 00:03:58 +0000 |
| commit | 8ca945088598029da262fa5a3449ee86950eff32 (patch) | |
| tree | b2b6a58796f0079c529c3d87749fc5e8aedda035 | |
| parent | d4db4fa359b3914ee9ff8ae27c09dc4f9c241a96 (diff) | |
| download | bcm5719-llvm-8ca945088598029da262fa5a3449ee86950eff32.tar.gz bcm5719-llvm-8ca945088598029da262fa5a3449ee86950eff32.zip | |
make ConstantFP::isExactlyValue work for long double as well.
llvm-svn: 49410
| -rw-r--r-- | llvm/include/llvm/Constants.h | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/llvm/include/llvm/Constants.h b/llvm/include/llvm/Constants.h index 13df601f418..b7c16e4f8c7 100644 --- a/llvm/include/llvm/Constants.h +++ b/llvm/include/llvm/Constants.h @@ -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; } |

