From patchwork Thu Sep 2 14:38:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: JonY X-Patchwork-Id: 63493 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 0D5A5B7176 for ; Fri, 3 Sep 2010 00:56:34 +1000 (EST) Received: (qmail 20220 invoked by alias); 2 Sep 2010 14:56:31 -0000 Received: (qmail 20200 invoked by uid 22791); 2 Sep 2010 14:56:28 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, TW_CX X-Spam-Check-By: sourceware.org Received: from mail-pz0-f47.google.com (HELO mail-pz0-f47.google.com) (209.85.210.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 02 Sep 2010 14:56:18 +0000 Received: by pzk2 with SMTP id 2so116929pzk.20 for ; Thu, 02 Sep 2010 07:56:17 -0700 (PDT) Received: by 10.142.43.8 with SMTP id q8mr268866wfq.191.1283439374721; Thu, 02 Sep 2010 07:56:14 -0700 (PDT) Received: from [192.168.1.253] ([60.52.92.113]) by mx.google.com with ESMTPS id y16sm313993wff.14.2010.09.02.07.56.11 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 02 Sep 2010 07:56:13 -0700 (PDT) Message-ID: <4C7FB6E2.4040503@users.sourceforge.net> Date: Thu, 02 Sep 2010 22:38:26 +0800 From: JonY User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080213 Thunderbird/2.0.0.12 Mnenhy/0.7.5.0 MIME-Version: 1.0 To: "Joseph S. Myers" CC: Gcc Patch List , Dave Korn , Kai Tietz Subject: Re: [PATCH] Allow decimal floats for mingw-w64 References: <4C73D99C.5050205@users.sourceforge.net> <4C73DDEA.2050400@users.sourceforge.net> In-Reply-To: <4C73DDEA.2050400@users.sourceforge.net> X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On 8/24/2010 22:57, JonY wrote: > On 8/24/2010 23:05, Joseph S. Myers wrote: >> On Tue, 24 Aug 2010, JonY wrote: >> >>> Hi, >>> >>> Attached patch enables i?86-w64-mingw32 and x86_64-w64-mingw32 >>> decimal float >>> support with bid. >> >> My previous comments about the several places to keep in sync >> apply >> equally to >> this patch (see also followups to the previous comments). >> > > Thanks for the heads up. New patch with quick fixes attached. > > Do you want the GCC_AC_ENABLE_DECIMAL_FLOAT version instead? Here is a new attached patch based on the link above. It mostly copies the existing logic and consolidates them into a single file. Bootstrap tested on i686-pc-cygwin. Index: gcc/configure =================================================================== --- gcc/configure (revision 163756) +++ gcc/configure (working copy) @@ -1577,9 +1577,9 @@ --enable-multilib enable library support for multiple ABIs --enable-__cxa_atexit enable __cxa_atexit for C++ --enable-decimal-float={no,yes,bid,dpd} - enable decimal float extension to C. Selecting 'bid' - or 'dpd' choses which decimal floating point format - to use + enable decimal float extension to C. Selecting 'bid' + or 'dpd' choses which decimal floating point format + to use --enable-fixed-point enable fixed-point arithmetic extension to C --enable-threads enable thread usage for target GCC --enable-threads=LIB use LIB thread package for target GCC @@ -6649,65 +6649,77 @@ # Enable C extension for decimal float if target supports it. -# Check whether --enable-decimal-float was given. + + # Enable C extension for decimal float if target supports it. + # Check whether --enable-decimal-float was given. if test "${enable_decimal_float+set}" = set; then : enableval=$enable_decimal_float; - case $enable_decimal_float in - yes | no | bid | dpd) ;; - *) as_fn_error "'$enable_decimal_float' is an invalid value for --enable-decimal-float. -Valid choices are 'yes', 'bid', 'dpd', and 'no'." "$LINENO" 5 ;; - esac + case $enable_decimal_float in + yes | no | bid | dpd) ;; + *) as_fn_error "'$enable_decimal_float' is an invalid value for --enable-decimal-float. + Valid choices are 'yes', 'bid', 'dpd', and 'no'." "$LINENO" 5 ;; + esac else - case $target in - powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux*) - enable_decimal_float=yes - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: decimal float is not supported for this target" >&5 + case $target in + powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux* | \ + i?86*-*-mingw* | x86_64*-*-mingw* | \ + i?86*-*-cygwin*) + enable_decimal_float=yes + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: decimal float is not supported for this target" >&5 $as_echo "$as_me: WARNING: decimal float is not supported for this target" >&2;} - enable_decimal_float=no - ;; - esac + enable_decimal_float=no + ;; + esac fi -dfp=`if test $enable_decimal_float != no; then echo 1; else echo 0; fi` + dfp=`if test $enable_decimal_float != no; then echo 1; else echo 0; fi` cat >>confdefs.h <<_ACEOF #define ENABLE_DECIMAL_FLOAT $dfp _ACEOF + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for decimal floating point" >&5 +$as_echo_n "checking for decimal floating point... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_decimal_float" >&5 +$as_echo "$enable_decimal_float" >&6; } -# x86's use BID format instead of DPD -case x$enable_decimal_float in - xyes) - case $target in - i?86*-*-linux* | x86_64*-*-linux*) - enable_decimal_float=bid - ;; - *) - enable_decimal_float=dpd - ;; - esac + # x86's use BID format instead of DPD + case x$enable_decimal_float in + xyes) + case $target in + i?86*-*-linux* | x86_64*-*-linux* | \ + i?86*-*-mingw* | x86_64*-*-mingw* | \ + i?86*-*-cygwin*) + enable_decimal_float=bid ;; - xno) - # ENABLE_DECIMAL_FLOAT is set to 0. But we have to have proper - # dependency on libdecnumber. + *) enable_decimal_float=dpd ;; -esac + esac + ;; + xno) + # ENABLE_DECIMAL_FLOAT is set to 0. But we have to have proper + # dependency on libdecnumber. + enable_decimal_float=dpd + ;; + esac + bid=`if test $enable_decimal_float = bid; then echo 1; else echo 0; fi` -bid=`if test $enable_decimal_float = bid; then echo 1; else echo 0; fi` - cat >>confdefs.h <<_ACEOF #define ENABLE_DECIMAL_BID_FORMAT $bid _ACEOF + + + # Enable C extension for fixed-point arithmetic. # Check whether --enable-fixed-point was given. if test "${enable_fixed_point+set}" = set; then : @@ -17130,7 +17142,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 17133 "configure" +#line 17145 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -17236,7 +17248,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 17239 "configure" +#line 17251 "configure" #include "confdefs.h" #if HAVE_DLFCN_H Index: gcc/aclocal.m4 =================================================================== --- gcc/aclocal.m4 (revision 163756) +++ gcc/aclocal.m4 (working copy) @@ -106,6 +106,7 @@ m4_include([../lt~obsolete.m4]) m4_include([../config/acx.m4]) m4_include([../config/codeset.m4]) +m4_include([../config/dfp.m4]) m4_include([../config/gettext-sister.m4]) m4_include([../config/iconv.m4]) m4_include([../config/lcmessage.m4]) Index: gcc/configure.ac =================================================================== --- gcc/configure.ac (revision 163756) +++ gcc/configure.ac (working copy) @@ -606,59 +606,8 @@ [], []) # Enable C extension for decimal float if target supports it. -AC_ARG_ENABLE(decimal-float, -[ --enable-decimal-float={no,yes,bid,dpd} - enable decimal float extension to C. Selecting 'bid' - or 'dpd' choses which decimal floating point format - to use], -[ - case $enable_decimal_float in - yes | no | bid | dpd) ;; - *) AC_MSG_ERROR(['$enable_decimal_float' is an invalid value for --enable-decimal-float. -Valid choices are 'yes', 'bid', 'dpd', and 'no'.]) ;; - esac -], -[ - case $target in - powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux*) - enable_decimal_float=yes - ;; - *) - AC_MSG_WARN(decimal float is not supported for this target, ignored) - enable_decimal_float=no - ;; - esac -]) +GCC_DFP_TARGET -dfp=`if test $enable_decimal_float != no; then echo 1; else echo 0; fi` -AC_DEFINE_UNQUOTED(ENABLE_DECIMAL_FLOAT, $dfp, -[Define to 1 to enable decimal float extension to C.]) - -# x86's use BID format instead of DPD -case x$enable_decimal_float in - xyes) - case $target in - i?86*-*-linux* | x86_64*-*-linux*) - enable_decimal_float=bid - ;; - *) - enable_decimal_float=dpd - ;; - esac - ;; - xno) - # ENABLE_DECIMAL_FLOAT is set to 0. But we have to have proper - # dependency on libdecnumber. - enable_decimal_float=dpd - ;; -esac -AC_SUBST(enable_decimal_float) - -bid=`if test $enable_decimal_float = bid; then echo 1; else echo 0; fi` -AC_DEFINE_UNQUOTED(ENABLE_DECIMAL_BID_FORMAT, $bid, -[Define to 1 to specify that we are using the BID decimal floating -point format instead of DPD]) - # Enable C extension for fixed-point arithmetic. AC_ARG_ENABLE(fixed-point, [ --enable-fixed-point enable fixed-point arithmetic extension to C], Index: libdecnumber/configure =================================================================== --- libdecnumber/configure (revision 163756) +++ libdecnumber/configure (working copy) @@ -1298,9 +1298,9 @@ --enable-werror-always enable -Werror despite compiler version --enable-maintainer-mode enable rules only needed by maintainers --enable-decimal-float={no,yes,bid,dpd} - enable decimal float extension to C. Selecting 'bid' - or 'dpd' choses which decimal floating point format - to use + enable decimal float extension to C. Selecting 'bid' + or 'dpd' choses which decimal floating point format + to use Some influential environment variables: CC C compiler command @@ -4584,47 +4584,77 @@ NONENONEs,x,x, && program_prefix=${target_alias}- -# Default decimal format -# If you change the defaults here, be sure to change them in the GCC directory also -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for decimal floating point" >&5 -$as_echo_n "checking for decimal floating point... " >&6; } -# Check whether --enable-decimal-float was given. + + # Enable C extension for decimal float if target supports it. + # Check whether --enable-decimal-float was given. if test "${enable_decimal_float+set}" = set; then : enableval=$enable_decimal_float; - case $enable_decimal_float in - yes | no | bid | dpd) ;; - *) as_fn_error "'$enable_decimal_float' is an invalid value for --enable-decimal-float. -Valid choices are 'yes', 'bid', 'dpd', and 'no'." "$LINENO" 5 ;; - esac + case $enable_decimal_float in + yes | no | bid | dpd) ;; + *) as_fn_error "'$enable_decimal_float' is an invalid value for --enable-decimal-float. + Valid choices are 'yes', 'bid', 'dpd', and 'no'." "$LINENO" 5 ;; + esac else - case $target in - powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux*) - enable_decimal_float=yes - ;; - *) - enable_decimal_float=no - ;; - esac + case $target in + powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux* | \ + i?86*-*-mingw* | x86_64*-*-mingw* | \ + i?86*-*-cygwin*) + enable_decimal_float=yes + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: decimal float is not supported for this target" >&5 +$as_echo "$as_me: WARNING: decimal float is not supported for this target" >&2;} + enable_decimal_float=no + ;; + esac fi -# x86's use BID format instead of DPD -# In theory --enable-decimal-float=no should not compile anything -# For the sake of simplicity, just use the default format in this directory -if test x$enable_decimal_float = xyes -o x$enable_decimal_float = xno; then - case $target in - i?86*-*-linux* | x86_64*-*-linux*) - enable_decimal_float=bid + dfp=`if test $enable_decimal_float != no; then echo 1; else echo 0; fi` + +cat >>confdefs.h <<_ACEOF +#define ENABLE_DECIMAL_FLOAT $dfp +_ACEOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for decimal floating point" >&5 +$as_echo_n "checking for decimal floating point... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_decimal_float" >&5 +$as_echo "$enable_decimal_float" >&6; } + + # x86's use BID format instead of DPD + case x$enable_decimal_float in + xyes) + case $target in + i?86*-*-linux* | x86_64*-*-linux* | \ + i?86*-*-mingw* | x86_64*-*-mingw* | \ + i?86*-*-cygwin*) + enable_decimal_float=bid + ;; + *) + enable_decimal_float=dpd + ;; + esac ;; - *) + xno) + # ENABLE_DECIMAL_FLOAT is set to 0. But we have to have proper + # dependency on libdecnumber. enable_decimal_float=dpd ;; esac -fi + bid=`if test $enable_decimal_float = bid; then echo 1; else echo 0; fi` + +cat >>confdefs.h <<_ACEOF +#define ENABLE_DECIMAL_BID_FORMAT $bid +_ACEOF + + + + + # If BID is being used, additional objects should be linked in. if test x$enable_decimal_float = xbid; then ADDITIONAL_OBJS="$ADDITIONAL_OBJS \$(bid_OBJS)" @@ -4632,11 +4662,8 @@ ADDITIONAL_OBJS= fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_decimal_float" >&5 -$as_echo "$enable_decimal_float" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if test "${ac_cv_c_bigendian+set}" = set; then : Index: libdecnumber/configure.ac =================================================================== --- libdecnumber/configure.ac (revision 163756) +++ libdecnumber/configure.ac (working copy) @@ -72,46 +72,8 @@ AC_CANONICAL_TARGET -# Default decimal format -# If you change the defaults here, be sure to change them in the GCC directory also -AC_MSG_CHECKING([for decimal floating point]) -AC_ARG_ENABLE(decimal-float, -[ --enable-decimal-float={no,yes,bid,dpd} - enable decimal float extension to C. Selecting 'bid' - or 'dpd' choses which decimal floating point format - to use], -[ - case $enable_decimal_float in - yes | no | bid | dpd) ;; - *) AC_MSG_ERROR(['$enable_decimal_float' is an invalid value for --enable-decimal-float. -Valid choices are 'yes', 'bid', 'dpd', and 'no'.]) ;; - esac -], -[ - case $target in - powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux*) - enable_decimal_float=yes - ;; - *) - enable_decimal_float=no - ;; - esac -]) +GCC_DFP_TARGET -# x86's use BID format instead of DPD -# In theory --enable-decimal-float=no should not compile anything -# For the sake of simplicity, just use the default format in this directory -if test x$enable_decimal_float = xyes -o x$enable_decimal_float = xno; then - case $target in - i?86*-*-linux* | x86_64*-*-linux*) - enable_decimal_float=bid - ;; - *) - enable_decimal_float=dpd - ;; - esac -fi - # If BID is being used, additional objects should be linked in. if test x$enable_decimal_float = xbid; then ADDITIONAL_OBJS="$ADDITIONAL_OBJS \$(bid_OBJS)" @@ -119,8 +81,6 @@ ADDITIONAL_OBJS= fi -AC_MSG_RESULT($enable_decimal_float) -AC_SUBST(enable_decimal_float) AC_SUBST(ADDITIONAL_OBJS) AC_C_BIGENDIAN Index: libdecnumber/config.in =================================================================== --- libdecnumber/config.in (revision 163756) +++ libdecnumber/config.in (working copy) @@ -3,6 +3,13 @@ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD +/* Define to 1 to specify that we are using the BID decimal floating point + format instead of DPD */ +#undef ENABLE_DECIMAL_BID_FORMAT + +/* Define to 1 to enable decimal float extension to C. */ +#undef ENABLE_DECIMAL_FLOAT + /* Define to 1 if you have the header file. */ #undef HAVE_CTYPE_H Index: libdecnumber/aclocal.m4 =================================================================== --- libdecnumber/aclocal.m4 (revision 163756) +++ libdecnumber/aclocal.m4 (working copy) @@ -11,6 +11,7 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. +m4_include([../config/dfp.m4]) m4_include([../config/override.m4]) m4_include([../config/stdint.m4]) m4_include([../config/warnings.m4]) Index: libgcc/configure =================================================================== --- libgcc/configure (revision 163756) +++ libgcc/configure (working copy) @@ -1278,9 +1278,9 @@ enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-decimal-float={no,yes,bid,dpd} - enable decimal float extension to C. Selecting 'bid' - or 'dpd' choses which decimal floating point format - to use + enable decimal float extension to C. Selecting 'bid' + or 'dpd' choses which decimal floating point format + to use --enable-tls Use thread-local storage [default=yes] Optional Packages: @@ -3634,42 +3634,77 @@ decimal_float=$libgcc_cv_dfp -# Check whether --enable-decimal-float was given. + + # Enable C extension for decimal float if target supports it. + # Check whether --enable-decimal-float was given. if test "${enable_decimal_float+set}" = set; then : enableval=$enable_decimal_float; - case $enable_decimal_float in - yes | no | bid | dpd) ;; - *) as_fn_error "'$enable_decimal_float' is an invalid value for --enable-decimal-float. -Valid choices are 'yes', 'bid', 'dpd', and 'no'." "$LINENO" 5 ;; - esac + case $enable_decimal_float in + yes | no | bid | dpd) ;; + *) as_fn_error "'$enable_decimal_float' is an invalid value for --enable-decimal-float. + Valid choices are 'yes', 'bid', 'dpd', and 'no'." "$LINENO" 5 ;; + esac else - case $host in - powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux*) - enable_decimal_float=yes - ;; - *) - enable_decimal_float=no - ;; - esac + case $target in + powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux* | \ + i?86*-*-mingw* | x86_64*-*-mingw* | \ + i?86*-*-cygwin*) + enable_decimal_float=yes + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: decimal float is not supported for this target" >&5 +$as_echo "$as_me: WARNING: decimal float is not supported for this target" >&2;} + enable_decimal_float=no + ;; + esac fi -# x86's use BID format instead of DPD -if test x$enable_decimal_float = xyes; then - case $host in - i?86*-*-linux* | x86_64*-*-linux*) - enable_decimal_float=bid + dfp=`if test $enable_decimal_float != no; then echo 1; else echo 0; fi` + +cat >>confdefs.h <<_ACEOF +#define ENABLE_DECIMAL_FLOAT $dfp +_ACEOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for decimal floating point" >&5 +$as_echo_n "checking for decimal floating point... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_decimal_float" >&5 +$as_echo "$enable_decimal_float" >&6; } + + # x86's use BID format instead of DPD + case x$enable_decimal_float in + xyes) + case $target in + i?86*-*-linux* | x86_64*-*-linux* | \ + i?86*-*-mingw* | x86_64*-*-mingw* | \ + i?86*-*-cygwin*) + enable_decimal_float=bid + ;; + *) + enable_decimal_float=dpd + ;; + esac ;; - *) + xno) + # ENABLE_DECIMAL_FLOAT is set to 0. But we have to have proper + # dependency on libdecnumber. enable_decimal_float=dpd ;; esac -fi + bid=`if test $enable_decimal_float = bid; then echo 1; else echo 0; fi` +cat >>confdefs.h <<_ACEOF +#define ENABLE_DECIMAL_BID_FORMAT $bid +_ACEOF + + + + + # Check for fixed-point support. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fixed-point is supported" >&5 $as_echo_n "checking whether fixed-point is supported... " >&6; } Index: libgcc/configure.ac =================================================================== --- libgcc/configure.ac (revision 163756) +++ libgcc/configure.ac (working copy) @@ -125,42 +125,8 @@ decimal_float=$libgcc_cv_dfp AC_SUBST(decimal_float) -AC_ARG_ENABLE(decimal-float, -[ --enable-decimal-float={no,yes,bid,dpd} - enable decimal float extension to C. Selecting 'bid' - or 'dpd' choses which decimal floating point format - to use], -[ - case $enable_decimal_float in - yes | no | bid | dpd) ;; - *) AC_MSG_ERROR(['$enable_decimal_float' is an invalid value for --enable-decimal-float. -Valid choices are 'yes', 'bid', 'dpd', and 'no'.]) ;; - esac -], -[ - case $host in - powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux*) - enable_decimal_float=yes - ;; - *) - enable_decimal_float=no - ;; - esac -]) +GCC_DFP_TARGET -# x86's use BID format instead of DPD -if test x$enable_decimal_float = xyes; then - case $host in - i?86*-*-linux* | x86_64*-*-linux*) - enable_decimal_float=bid - ;; - *) - enable_decimal_float=dpd - ;; - esac -fi -AC_SUBST(enable_decimal_float) - # Check for fixed-point support. AC_CACHE_CHECK([whether fixed-point is supported], [libgcc_cv_fixed_point], [AC_COMPILE_IFELSE([_Sat _Fract x;], [libgcc_cv_fixed_point=yes],