Hi all: I need an instruction that can convert decimal values into floating point numbers. i.e. say I have a decimal number 1110794174 (== 42355FBE in hex ) and (=45.3435 as a float) essentially the mantissa and exponent representation needs to be used. Is there any way of doing this in llvm? Thanks and Regards -- -- Aparna Kotha Graduate Student Electrical and Computer Engineering University of Maryland, College Park -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090318/173028fc/attachment.html>
On Mar 18, 2009, at 12:18 PMPDT, aparna kotha wrote:> Hi all: > > I need an instruction that can convert decimal values into floating > point numbers. > > i.e. say I have a decimal number 1110794174 (== 42355FBE in hex ) > and (== 45.3435 as a float) > > essentially the mantissa and exponent representation needs to be used. > > Is there any way of doing this in llvm?Not entirely sure what you're after, but if you want to interpret the bits of the int as floating point, use bitcast.
This works :-) define float @foo(i32 %i) nounwind readnone optsize { entry: %tmp2 = bitcast i32 %i to float ret float %tmp2 } -bw 2009/3/18 aparna kotha <kotha.aparna at gmail.com>:> Hi all: > > I need an instruction that can convert decimal values into floating point > numbers. > > i.e. say I have a decimal number 1110794174 (== 42355FBE in hex ) and (=> 45.3435 as a float) > > essentially the mantissa and exponent representation needs to be used. > > > Is there any way of doing this in llvm? > > > > > Thanks and Regards > > -- > -- Aparna Kotha > Graduate Student > Electrical and Computer Engineering > University of Maryland, College Park > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >
aparna kotha wrote:> Hi all: > > I need an instruction that can convert decimal values into floating > point numbers. > > i.e. say I have a decimal number 1110794174 (== 42355FBE in hex ) and > (== 45.3435 as a float) > > essentially the mantissa and exponent representation needs to be used. > > > Is there any way of doing this in llvm?I think you're looking for "bitcast i32 1110794174 to float"
Thanks. Should work for me On Wed, Mar 18, 2009 at 4:34 PM, Frits van Bommel <fvbommel at wxs.nl> wrote:> aparna kotha wrote: > > Hi all: > > > > I need an instruction that can convert decimal values into floating > > point numbers. > > > > i.e. say I have a decimal number 1110794174 (== 42355FBE in hex ) and > > (== 45.3435 as a float) > > > > essentially the mantissa and exponent representation needs to be used. > > > > > > Is there any way of doing this in llvm? > > I think you're looking for "bitcast i32 1110794174 to float" > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-- -- Aparna -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090318/2e76d75d/attachment.html>