From patchwork Mon Nov 22 13:05:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: introduce __FLOAT_WORD_ORDER__ in lieu of LIBGCC2_FLOAT_WORDS_BIG_ENDIAN Date: Mon, 22 Nov 2010 03:05:52 -0000 From: Nathan Froyd X-Patchwork-Id: 72558 Message-Id: <20101122130551.GA24469@nightcrawler> To: gcc-patches@gcc.gnu.org Just as $SUBJECT suggests. The only target where this could possibly matter is ARM, since it has a non-trivial implementation of FLOAT_WORDS_BIG_ENDIAN. However, as discussed in: http://gcc.gnu.org/ml/gcc/2010-11/msg00393.html the ARM ABI doesn't implement decimal floats (so ARM is not affected by the libdecnumber/libbid changes) and contains its own custom FP functions, so any FP-related changes don't matter either. Tested on x86_64-unknown-linux-gnu. OK to commit? -Nathan gcc/ * cppbuiltin.c (define_builtin_macros_for_type_sizes): Define __FLOAT_WORD_ORDER__ according to FLOAT_WORDS_BIG_ENDIAN. * config/dfp-bit.h (LIBGCC2_FLOAT_WORDS_BIG_ENDIAN): Delete. * doc/cpp.texi (__FLOAT_WORD_ORDER__): Document. * system.h (LIBGCC2_FLOAT_WORDS_BIG_ENDIAN): Poison. libgcc/ * config/libbid/bid_conf.h (BID_BIG_ENDIAN): Define in terms of __FLOAT_WORD_ORDER__. * config/libbid/bid_gcc_intrinsics.h (LIBGCC2_FLOAT_WORDS_BIG_ENDIAN): Delete. libdecnumber/ * dconfig.h (LIBGCC2_FLOAT_WORDS_BIG_ENDIAN): Delete. (WORDS_BIG_ENDIAN): Define based on value of __FLOAT_WORD_ORDER__. diff --git a/gcc/config/dfp-bit.h b/gcc/config/dfp-bit.h index 20688b1..c1ee377 100644 --- a/gcc/config/dfp-bit.h +++ b/gcc/config/dfp-bit.h @@ -33,11 +33,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "coretypes.h" #include "tm.h" -#ifndef LIBGCC2_FLOAT_WORDS_BIG_ENDIAN -#define LIBGCC2_FLOAT_WORDS_BIG_ENDIAN \ - (__BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__) -#endif - #ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE #endif diff --git a/gcc/cppbuiltin.c b/gcc/cppbuiltin.c index 7ed6080..f0f650f 100644 --- a/gcc/cppbuiltin.c +++ b/gcc/cppbuiltin.c @@ -157,6 +157,11 @@ define_builtin_macros_for_type_sizes (cpp_reader *pfile) cpp_define (pfile, "__BYTE_ORDER__=__ORDER_PDP_ENDIAN__"); } + cpp_define_formatted (pfile, "__FLOAT_WORD_ORDER__=%s", + (FLOAT_WORDS_BIG_ENDIAN + ? "__ORDER_BIG_ENDIAN__" + : "__ORDER_LITTLE_ENDIAN__")); + /* ptr_type_node can't be used here since ptr_mode is only set when toplev calls backend_init which is not done with -E switch. */ cpp_define_formatted (pfile, "__SIZEOF_POINTER__=%d", diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi index ddcf814..7d78d12 100644 --- a/gcc/doc/cpp.texi +++ b/gcc/doc/cpp.texi @@ -2289,6 +2289,11 @@ You should use these macros for testing like this: #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ @end smallexample +@item __FLOAT_WORD_ORDER__ +@code{__FLOAT_WORD_ORDER__} is defined to one of the values +@code{__ORDER_LITTLE_ENDIAN__} or @code{__ORDER_BIG_ENDIAN__} to reflect +the layout of the words of multi-word floating-point quantities. + @item __DEPRECATED This macro is defined, with value 1, when compiling a C++ source file with warnings about deprecated constructs enabled. These warnings are diff --git a/gcc/system.h b/gcc/system.h index 73e5139..d37ff2a 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -799,7 +799,8 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; TARGET_HANDLE_OFAST TARGET_OPTION_OPTIMIZATION /* Hooks into libgcc2. */ - #pragma GCC poison LIBGCC2_DOUBLE_TYPE_SIZE LIBGCC2_WORDS_BIG_ENDIAN + #pragma GCC poison LIBGCC2_DOUBLE_TYPE_SIZE LIBGCC2_WORDS_BIG_ENDIAN \ + LIBGCC2_FLOAT_WORDS_BIG_ENDIAN /* Miscellaneous macros that are no longer used. */ #pragma GCC poison USE_MAPPED_LOCATION diff --git a/libdecnumber/dconfig.h b/libdecnumber/dconfig.h index 26b963c..503cb61 100644 --- a/libdecnumber/dconfig.h +++ b/libdecnumber/dconfig.h @@ -28,12 +28,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "coretypes.h" #include "tm.h" -#ifndef LIBGCC2_FLOAT_WORDS_BIG_ENDIAN -#define LIBGCC2_FLOAT_WORDS_BIG_ENDIAN \ - (__BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__) -#endif - -#if LIBGCC2_FLOAT_WORDS_BIG_ENDIAN +#if __FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__ #define WORDS_BIGENDIAN 1 #endif diff --git a/libgcc/config/libbid/bid_conf.h b/libgcc/config/libbid/bid_conf.h index d22980d..93e60ed 100644 --- a/libgcc/config/libbid/bid_conf.h +++ b/libgcc/config/libbid/bid_conf.h @@ -516,7 +516,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #endif #ifndef BID_BIG_ENDIAN -#define BID_BIG_ENDIAN LIBGCC2_FLOAT_WORDS_BIG_ENDIAN +#define BID_BIG_ENDIAN __FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__ #endif #ifndef BID_THREAD diff --git a/libgcc/config/libbid/bid_gcc_intrinsics.h b/libgcc/config/libbid/bid_gcc_intrinsics.h index f536e3b..7d65705 100644 --- a/libgcc/config/libbid/bid_gcc_intrinsics.h +++ b/libgcc/config/libbid/bid_gcc_intrinsics.h @@ -30,11 +30,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "coretypes.h" #include "tm.h" -#ifndef LIBGCC2_FLOAT_WORDS_BIG_ENDIAN -#define LIBGCC2_FLOAT_WORDS_BIG_ENDIAN \ - (__BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__) -#endif - #ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE #endif