[LLVMdev] troubles with llvm-gcc 4.0 and APFloat on X86_64

Dale Johannesen dalej at apple.com
Fri Oct 19 11:11:29 PDT 2007


On Oct 19, 2007, at 7:23 AM, Dietmar Ebner wrote:

> hi,
>
> i'm trying to make some experiments with the ARM backend (llvm 2.1)  
> and
> therefore built an arm-softfloat-linux-gnu toolchain on x86_64 linux.
>
> however, the llvm-gcc frontend seems to cause troubles with single
> precision floating point values, i.e., they are not converted  
> correctly
> to the particular target format (double precision works as expected).

I haven't seen this problem.  You say the frontend; to check,

llvm-gcc -O0 -S -emit-llvm file.c -o file.ll

produces an invalid constant in the .ll file?  Can you give an example?

> it seems the problem is related to the following piece of code taken
> from APFloat.cpp:1836 (called from ConvertREAL_CST)
> 	APFloat::APFloat(float f) {
> 	  APInt api = APInt(32, 0);
> 	  initFromAPInt(api.floatToBits(f));
> 	}
>
> i guess the floatToBits call will return the wrong half word since  
> ints
> are 4, but float and double are both 8 byte on x86_64 (but i'm not yet
> sure).

I'm pretty sure float is 4 everywhere; that wouldn't be it.

> is anybody having the same kind of problems or is there an official
> patch for this issue? is llvm-gcc known to work as a cross compiler on
> x86_64 for 32 bit targets and/or arm in particular?

I have no 64-bit host available.  Cross-compilation between x86-32  
and powerPC
(different endianness) works correctly.




More information about the llvm-dev mailing list