[LLVMdev] FP128Ty

Dale Johannesen dalej at apple.com
Tue Feb 17 11:22:05 PST 2009


On Feb 17, 2009, at 10:56 AMPST, Dale Johannesen wrote:

>
> On Feb 16, 2009, at 6:36 PMPST, Chris Lattner wrote:
>
>>
>> On Feb 16, 2009, at 6:12 PM, aparna kotha wrote:
>>
>>> I am new to llvm and am stuck up with a problem.
>>> I am trying to initialize a Value* of type fp128 having the value 0
>>>
>>> I am using the following construct
>>>
>>> ConstantFP::get(APFloat(APInt(128,0,false)));

Also, the 3rd parameter should be "true" for Fp128.  This call is  
getting you PowerPC 128-bit format, which is two doubles stuck  
together; that's probably why it looks like a double to you.  This  
format has lots of weird numeric properties, and you don't want to use  
it unless you're targeting PowerPC.

>>> This is returning a double instead of a float and I am confused.
>>>
>>> Thanks a lot for your help.
>>
>> FP128Ty is stubbed out, but completely untested and not supported by
>> any targets yet.
>
> More specifically, the compile-time arithmetic stuff *should* Just  
> Work, although nobody has tried it; the conversions of FP128 to and  
> from other formats are not done.  They should not be difficult to do  
> by copying & modifying existing code.  To do specifically what  
> you're trying to do, add the FP128 case to APFloat::initFromAPInt.   
> The code that reads and writes the IR, and writes assembler output,  
> also needs to be added.
>
> (The Float in APFloat means "floating point", not the C float type.)




More information about the llvm-dev mailing list