[LLVMdev] ConstantFoldBinaryFP and cross compilation

David Tweed david.tweed at arm.com
Wed May 1 09:57:27 PDT 2013

On Sat, Apr 27, 2013 at 7:26 PM, Nick Lewycky <nicholas at mxc.ca> wrote:

I just want LLVM to behave the same on whatever platform it's run on. People already accept that depending on iteration order is a bug, but it's been harder to get people to accept that llvm needs bit-exact floating point constant folding, especially given the implementation difficulty.


| I'll give a huge +1 to this.


| I think that long-term LLVM should, out of the box, support strictly correct (according to IEEE) floating point folding outside of fast-math, and should provide aggressive as hell folding inside of fast-math.


I'm a bit conflicted. On the one hand we have _some_ user code where things like addition of literal +0.0f in LLVM IR are being used for their side effects so that having a default mode that guaranteed not to fold them away would be helpful. On the other hand, as someone who sometimes writes numeric code I don't like the lumping of lots and lots of things to which the user code might have differing sensitivity under just one fast-math switch. For example, it might be appropriate to use the equivalent of gcc's ffinite-math-only without assuming the equivalent of gcc's funsafe-math-optimizations (which could dramatically lose precision even though for finite inputs it did ensure finite outputs.) In particular, it'd be nice to be able to have options to get constant-folding-to-host-accuracy without going in to the minefield of enabling full-blown fast-math. Unfortunately I'm not in a position to actually do anything about this presently.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130501/2e9cb82e/attachment.html>

More information about the llvm-dev mailing list