summaryrefslogtreecommitdiff
path: root/lib/Support/APFloat.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2008-10-06 18:22:29 +0000
committerDale Johannesen <dalej@apple.com>2008-10-06 18:22:29 +0000
commitd3d8ce3aba85b40999eddbec3956f5b9534a36ff (patch)
treed93c4027a6a7903202faafa9e3f24c0aebedd58e /lib/Support/APFloat.cpp
parente76225a4c1f185e7a00f790f956bd3ff0e017c90 (diff)
downloadllvm-d3d8ce3aba85b40999eddbec3956f5b9534a36ff.tar.gz
llvm-d3d8ce3aba85b40999eddbec3956f5b9534a36ff.tar.bz2
llvm-d3d8ce3aba85b40999eddbec3956f5b9534a36ff.tar.xz
Mark shortening NaN conversions as Inexact. PR 2856.
Improve description of unsupported formats. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57185 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/APFloat.cpp')
-rw-r--r--lib/Support/APFloat.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/Support/APFloat.cpp b/lib/Support/APFloat.cpp
index b948e8f43a..df65f112af 100644
--- a/lib/Support/APFloat.cpp
+++ b/lib/Support/APFloat.cpp
@@ -1727,11 +1727,12 @@ APFloat::convert(const fltSemantics &toSemantics,
APInt::tcShiftLeft(significandParts(), newPartCount, shift);
else if (shift < 0)
APInt::tcShiftRight(significandParts(), newPartCount, -shift);
+ // If the new size is shorter, we lost information.
+ fs = (shift < 0) ? opInexact : opOK;
// gcc forces the Quiet bit on, which means (float)(double)(float_sNan)
// does not give you back the same bits. This is dubious, and we
// don't currently do it. You're really supposed to get
// an invalid operation signal at runtime, but nobody does that.
- fs = opOK;
} else {
semantics = &toSemantics;
fs = opOK;
@@ -2633,11 +2634,13 @@ APFloat::convertToDouble() const
return api.bitsToDouble();
}
-/// Integer bit is explicit in this format. Current Intel book does not
-/// define meaning of:
-/// exponent = all 1's, integer bit not set.
-/// exponent = 0, integer bit set. (formerly "psuedodenormals")
-/// exponent!=0 nor all 1's, integer bit not set. (formerly "unnormals")
+/// Integer bit is explicit in this format. Intel hardware (387 and later)
+/// does not support these bit patterns:
+/// exponent = all 1's, integer bit 0, significand 0 ("pseudoinfinity")
+/// exponent = all 1's, integer bit 0, significand nonzero ("pseudoNaN")
+/// exponent = 0, integer bit 1 ("pseudodenormal")
+/// exponent!=0 nor all 1's, integer bit 0 ("unnormal")
+/// At the moment, the first two are treated as NaNs, the second two as Normal.
void
APFloat::initFromF80LongDoubleAPInt(const APInt &api)
{