[LLVMdev] creating 80/128bit FP constants?

3 views
Skip to first unread message

edA-qa mort-ora-y

unread,
Apr 30, 2013, 1:33:07 AM4/30/13
to <llvmdev@cs.uiuc.edu>
How do I emit 80/128 bit FP constants. There is one ConstantFP::get
function which takes a double and another that takes a StringRef. Does
the StringRef version somehow do what I want?

--
edA-qa mort-ora-y
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Sign: Please digitally sign your emails.
Encrypt: I'm also happy to receive encrypted mail.

signature.asc

Duncan Sands

unread,
May 1, 2013, 6:21:33 AM5/1/13
to llv...@cs.uiuc.edu
On 30/04/13 07:33, edA-qa mort-ora-y wrote:
> How do I emit 80/128 bit FP constants. There is one ConstantFP::get
> function which takes a double and another that takes a StringRef. Does
> the StringRef version somehow do what I want?

Use the one that takes an APFloat.

Ciao, Duncan.

_______________________________________________
LLVM Developers mailing list
LLV...@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

edA-qa mort-ora-y

unread,
May 1, 2013, 6:28:31 AM5/1/13
to llv...@cs.uiuc.edu
On 01/05/13 12:21, Duncan Sands wrote:
>> How do I emit 80/128 bit FP constants. There is one ConstantFP::get
>> function which takes a double and another that takes a StringRef. Does
>> the StringRef version somehow do what I want?
> Use the one that takes an APFloat.

APFloat then offers the float/double/string constructors, and various
operations. I'm still not sure on how I can get a 80/128 bit float. Is
there an example somewhere?
signature.asc

Shuxin Yang

unread,
May 1, 2013, 1:03:14 PM5/1/13
to edA-qa mort-ora-y, llv...@cs.uiuc.edu
There are example in unittests/ADT/APFloatTest.cpp

Create 80-bit FP (on x8664, it is corresponding to "long double" in C/C++):

      APFloat(APFloat::x87DoubleExtended, "0xf.fffffffp+28");

Create 128-bit:
     I don't know if llvm have run-time lib support for quadruple-precision FP arithmetic.



On 5/1/13 3:28 AM, edA-qa mort-ora-y wrote:
On 01/05/13 12:21, Duncan Sands wrote:
How do I emit 80/128 bit FP constants. There is one ConstantFP::get
function which takes a double and another that takes a StringRef.  Does
the StringRef version somehow do what I want?
Use the one that takes an APFloat.
APFloat then offers the float/double/string constructors, and various
operations. I'm still not sure on how I can get a 80/128 bit float. Is
there an example somewhere?




Reply all
Reply to author
Forward
0 new messages