[LLVMdev] [RFC] Add a simple soft-float class

Andrew Trick atrick at apple.com
Wed Jun 18 21:14:12 PDT 2014


On Jun 18, 2014, at 8:38 PM, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:

>> 
>> On 2014 Jun 18, at 13:29, Owen Anderson <resistor at mac.com> wrote:
>> 
>> Numerical analysis is hard.  Every numerics expert I have ever worked with considers trying to re-invent floating point a cardinal sin of numerical analysis.  Just don’t do it.  You will miss important considerations, and you will pay the price for it later.  Plus, anyone in the future who wants to modify your code has to learn a new set of non-standard floating point numerics, and without a well-defined specification it’s not always clear what the correct semantics in a particular case are.
> 
> Okay.  To me this sounds like dogma, but I'll defer to your judgement.

Is there any way we have this utility and just not claim that it is for use with a numerics package? The only claim we’re making is that it is a useful utility for writing compiler heuristics. We can do that without waking any Dragons, and Duncan’s design is quite straightforward.

I think calling it a “soft-float” implementation was a mistake (even though that’s what it is), and has completely derailed this thread.

The goal is to factor and reuse the code that we need to reinvent every time we need to extend the dynamic range of some of cost metric. The question here is whether that in itself a worthwhile goal, independent of how the compiler models language level floats. I have nothing *against* repurposing APFloat. After all, we only have a couple metrics in tree that need this new utility. But let’s be clear that APFloat's purpose is completely different, so it’s not like we’re reinventing any existing utility.

I honestly think we should consider not calling this a Float at all just to avoid the obvious confusion. I’m fine calling it a ScaledNumber or something.

-Andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140618/3af59c6b/attachment.html>


More information about the llvm-dev mailing list