[llvm-commits] [llvm] r57185 - /llvm/trunk/lib/Support/APFloat.cpp

Dan Gohman gohman at apple.com
Mon Oct 6 11:51:23 PDT 2008


On Oct 6, 2008, at 11:22 AM, Dale Johannesen wrote:

> Author: johannes
> Date: Mon Oct  6 13:22:29 2008
> New Revision: 57185
>
> URL: http://llvm.org/viewvc/llvm-project?rev=57185&view=rev
> Log:
> Mark shortening NaN conversions as Inexact.  PR 2856.
> Improve description of unsupported formats.
>
>
> Modified:
>    llvm/trunk/lib/Support/APFloat.cpp
>
> Modified: llvm/trunk/lib/Support/APFloat.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=57185&r1=57184&r2=57185&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/Support/APFloat.cpp (original)
> +++ llvm/trunk/lib/Support/APFloat.cpp Mon Oct  6 13:22:29 2008
> @@ -1727,11 +1727,12 @@
>       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;

Shouldn't converting a NaN set the opInvalidOp flag?

Dan




More information about the llvm-commits mailing list