Hi Guys, The RX port currently has a problem with the software implementation of 64-bit doubles - the libgcc functions produce bogus results. I tracked this down to this definition in libgcc/fp-bit.h:
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #define FLOAT_BIT_ORDER_MISMATCH #endif For the RX __BYTE_ORDER__ is __ORDER_LITTLE_ENDIAN__, but the bits in the doubles are in little endian order, so FLOAT_BIT_ORDER_MISMATCH should not be defined. I have produced a patch (see below) that fixes this problem for me by allowing the target to specify FLOAT_BIT_ORDER_MISMATCH explicitly, if it wants to. This matches the old behaviour (in gcc 4.6 and earlier) before fp-bit.h was moved to the libgcc directory. I suspect however that this may not be the correct solution, so I am asking for comments as to how the problem should be solved. If my approach is correct however, then please may I apply the patch ? Cheers Nick libgcc/ChangeLog 2012-06-13 Nick Clifton <ni...@redhat.com> * fp-bit.h (FLOAT_BIT_ORDER_MISMATCH): If LIBGCC2_FLOAT_BIT_ORDER_MISMATCH is defined then use this to determine if FLOAT_BIT_ORDER_MISMATCH should be defined. * config/rx/rx-lib.h (LIBGCC2_FLOAT_BIT_ORDER_MISMATCH): Define to false. Index: libgcc/fp-bit.h =================================================================== --- libgcc/fp-bit.h (revision 188497) +++ libgcc/fp-bit.h (working copy) @@ -129,9 +129,21 @@ #define NO_DI_MODE #endif +/* Allow the target the chance to specify whether + the bit order matches the byte order. */ +#if defined LIBGCC2_FLOAT_BIT_ORDER_MISMATCH +/* Evaluate the expression - it might be zero. */ +#if LIBGCC2_FLOAT_BIT_ORDER_MISMATCH +#define FLOAT_BIT_ORDER_MISMATCH +#else +#undef FLOAT_BIT_ORDER_MISMATCH +#endif +#else +/* Otherwise assume that the bits within a byte are in big endian order. */ #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #define FLOAT_BIT_ORDER_MISMATCH #endif +#endif #if __BYTE_ORDER__ != __FLOAT_WORD_ORDER__ #define FLOAT_WORD_ORDER_MISMATCH Index: libgcc/config/rx/rx-lib.h =================================================================== --- libgcc/config/rx/rx-lib.h (revision 188497) +++ libgcc/config/rx/rx-lib.h (working copy) @@ -1,5 +1,10 @@ -#ifndef __RX_64BIT_DOUBLES__ +#if defined __RX_64BIT_DOUBLES__ +#undef FLOAT_ONLY +#elif defined __RX_32BIT_DOUBLES__ #define DF SF #define FLOAT_ONLY +#else +#error "RX double size not defined" #endif +#define LIBGCC2_FLOAT_BIT_ORDER_MISMATCH 0