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

Dale Johannesen dalej at apple.com
Mon Oct 6 17:40:03 PDT 2008


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;
   }
 
   src = significandParts();





More information about the llvm-commits mailing list