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

Neil Booth neil at daikokuya.co.uk
Tue Oct 7 06:21:39 PDT 2008


Dale Johannesen wrote:-

> Author: johannes
> Date: Mon Oct  6 19:40:01 2008
> New Revision: 57224
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=57224&view=rev
> Log:
> Mark negative-zero-to-int conversion as Inexact,
> since -0.0 can't be represented as an int.
> This prevents llvm from reducing -0.0 to a
> load-and-convert of int 0.  Fixes
> ieee.exp/mzero[2356].c in gcc testsuite.
> 
> 
> 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=57224&r1=57223&r2=57224&view=diff
> 
> ==============================================================================
> --- llvm/trunk/lib/Support/APFloat.cpp (original)
> +++ llvm/trunk/lib/Support/APFloat.cpp Mon Oct  6 19:40:01 2008
> @@ -1784,7 +1784,8 @@
>  
>    if(category == fcZero) {
>      APInt::tcSet(parts, 0, dstPartsCount);
> -    return opOK;
> +    // Negative zero can't be represented as an int.
> +    return sign ? opInexact : opOK;
>    }

See my other mail.  This and your other changes is abandoning the
original intent of APFloat, to become some kind of fuzzy semantics.
I am not in favour of this.

Neil.



More information about the llvm-commits mailing list