PowerPC long double

Ira Hill ijh3@ufl.edu
Fri Sep 7 19:08:00 GMT 2012


Hello,

  I've compiled Binutils 2.22 and GCC 4.7.0 to work with our PowerPC 
target running VxWorks. The goal has to been make use of the long double 
data type, which I believe can be implemented as two doubles on 
PowerPC.  I'm able to make a successful tool chain but long double is 
still the same as double.

"powerpc-wrs-vxworks-g++ -v"
Target: powerpc-wrs-vxworks
Configured with: ../gcc-4.7.0/configure 
--prefix=/usr/local/share/powerpc-vxworks 
--with-headers=/home/darkknight/Code/crossCompile/WindRiver/vxworks-6.3/target/h 
--with-cpu=default32 --with-system-zlib --target=powerpc-wrs-vxworks 
--with-gnu-ld --with-gnu-as --enable-languages=c,c++ --with-long-double-128
Thread model: vxworks
gcc version 4.7.0 (GCC)

But when I test the toolchain with "powerpc-wrs-vxworks-g++ -dM -E -xc 
/dev/null | grep LDBL", I get:
#define __LDBL_MAX__ 1.7976931348623157e+308L
#define __LDBL_MAX_EXP__ 1024
#define __LDBL_HAS_INFINITY__ 1
#define __LDBL_MIN__ 2.2250738585072014e-308L
#define __LDBL_HAS_QUIET_NAN__ 1
#define __LDBL_HAS_DENORM__ 1
#define __LDBL_EPSILON__ 2.2204460492503131e-16L
#define __LDBL_MANT_DIG__ 53
#define __LDBL_MIN_EXP__ (-1021)
#define __LDBL_MAX_10_EXP__ 308
#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L
#define __LDBL_MIN_10_EXP__ (-307)
#define __LDBL_DIG__ 15

Now I also can enable the "-mlong-double-128" flag which appears to give 
me quad precision, but that produces binaries with undefined symbols on 
my target (_q_mul, _q_add, etc..) and will not run.

"powerpc-wrs-vxworks-g++ -dM -E -xc -mlong-double-128 /dev/null | grep LDBL"
#define __LDBL_MAX__ 1.18973149535723176508575932662800702e+4932L
#define __LDBL_MAX_EXP__ 16384
#define __LDBL_HAS_INFINITY__ 1
#define __LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L
#define __LDBL_HAS_QUIET_NAN__ 1
#define __LDBL_HAS_DENORM__ 1
#define __LDBL_EPSILON__ 1.92592994438723585305597794258492732e-34L
#define __LDBL_MANT_DIG__ 113
#define __LDBL_MIN_EXP__ (-16381)
#define __LDBL_MAX_10_EXP__ 4932
#define __LDBL_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966L
#define __LDBL_MIN_10_EXP__ (-4931)
#define __LDBL_DIG__ 33

I've also tried the "-mabi=ieeelongdouble" and "-mabi=ibmlongdouble" 
which have no effect.

Is there a way for me to enable extended precision which gives me long 
double as two doubles on powerpc-vxworks (which can hopefully execute)? 
Or if I have to use the "-mlong-double-128" flag, how can I handle the 
undefined symbols for the math operations?

Thanks,
Ira



More information about the Gcc-help mailing list