[cfe-commits] [llvm-commits] [patch] fp128 sint_to_fp folding fix

Tim Northover t.p.northover at gmail.com
Thu Jan 17 04:37:54 PST 2013


Hi again,

This clang part of the patch has been waiting for quite a while now.
Could someone look at it?

Cheers.

Tim.

>> I've got some updated patches here that remove any default behaviour; as
>> Duncan pointed out it *is* largely inappropriate. The new interface is
>>
>>     APFloat::APFloat(const fltSemantics&, const APInt&)
>>
>> On the whole it turned out rather neatly. When needed, the fltSemantics
>> were usually easy to come by, even though there's a redundancy in APInt
>> size and semantics for the smaller cases.
>>
>> I experimented with alternatives before settling on this (ignore names):
>>
>>     APFloat::APFloat(const APInt&) // Faults if 128-bit attempted
>>     APFloat::getIEEEQuad(const APInt&)
>>     APFloat::getPPCDblDbl(const APInt&)
>>
>> This seemed promising, but there were lots of places where code wanted to
>> all floating-point types, so some generic function was beneficial, and at
>> that point is it really worth adding a helper that only works for types <
>> 64 bits. You can bet someone will use it without thinking things through
>> properly.
>>
>>     APFloat::APFloat(const APInt&, enum { irrelevent, ieee128, ppc128 })
>>
>> This was basically the same as the chosen variant, except that it
>> introduced a largely redundant enum.
>>
>> I'm much less certain about the patch to Clang. What was there was clearly
>> wrong: AST serialisation didn't save the IsIEEE property, however there's
>> no existing good way to serialise an fltSemantics. Is there a better way
>> I've missed, or should I put the enum in a more standard place? There
>> didn't seem to be a directly equivalent construct.
>>
>> Tim.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: apfloat-constructor-clang.diff
Type: application/octet-stream
Size: 5881 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130117/857b86af/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: apfloat-constructor-llvm.diff
Type: application/octet-stream
Size: 31442 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130117/857b86af/attachment-0001.obj>


More information about the cfe-commits mailing list