diff options
author | Michael Meissner <michael.meissner@amd.com> | 2007-03-24 17:04:47 +0000 |
---|---|---|
committer | Michael Meissner <meissner@gcc.gnu.org> | 2007-03-24 17:04:47 +0000 |
commit | 79b87c74d764bd42703818289685e48996b54eb8 (patch) | |
tree | ec50c8ab7786788a6da7d4f06b0cd93e9555d487 /gcc | |
parent | cca643862ddb1f61f200b567c667576d39961fb2 (diff) | |
download | gcc-79b87c74d764bd42703818289685e48996b54eb8.zip gcc-79b87c74d764bd42703818289685e48996b54eb8.tar.gz gcc-79b87c74d764bd42703818289685e48996b54eb8.tar.bz2 |
Add BID decimal support
Co-Authored-By: H.J. Lu <hongjiu.lu@intel.com>
Co-Authored-By: Marius Cornea <marius.cornea@intel.com>
From-SVN: r123185
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 65 | ||||
-rw-r--r-- | gcc/Makefile.in | 6 | ||||
-rw-r--r-- | gcc/c-cppbuiltin.c | 11 | ||||
-rw-r--r-- | gcc/config.in | 6 | ||||
-rw-r--r-- | gcc/config/dfp-bit.c | 4 | ||||
-rw-r--r-- | gcc/config/dfp-bit.h | 170 | ||||
-rwxr-xr-x | gcc/configure | 57 | ||||
-rw-r--r-- | gcc/configure.ac | 51 | ||||
-rw-r--r-- | gcc/dfp.c | 16 | ||||
-rw-r--r-- | gcc/doc/install.texi | 17 | ||||
-rw-r--r-- | gcc/optabs.c | 83 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/dfp/convert-dfp.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/dfp/convert-int-saturate.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/dfp/decfloat-constants.c | 3 |
15 files changed, 370 insertions, 132 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6f14062..3f12200 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,68 @@ +2007-03-23 Michael Meissner <michael.meissner@amd.com> + H.J. Lu <hongjiu.lu@intel.com> + + * config/dfp-bit.h (DPD_BID_NAME): New macro to give either the + DPD or BID name. + (name macros): Use DPD_BID_NAME to convert names properly. + + * optabs.c (DECIMAL_PREFIX): Prefix string to use for the current + decimal floating point format. + (init_floating_libfuncs): Change decimal functions so that they + have a "bid_" prefix if the decimal system uses the BID format, + and "dpd_" prefix if the decimal system uses the DPD format. + (init_interclass_conv_libfuncs): Ditto. + (init_intraclass_conv_libfuncs): Ditto. + + * config.in (ENABLE_DECIMAL_BID_FORMAT): New macro to say we are + using the BID format. + + * configure.ac (ENABLE_DECIMAL_BID_FORMAT): Set to 1/0 to say + whether we are using the BID decimal format. + * configure: Regenerate. + + * c-cppbuiltin.c (c_cpp_builtins): Define __STDC_WANT_DEC_FP__ if + the compiler has decimal floating point enabled. Define + __DECIMAL_BID_FORMAT__ if BID decimal floating point is used + instead of DPD. + + * config.in (ENABLE_DECIMAL_BID_FORMAT): New macro to say we are + using the BID format. + + * configure.ac (ENABLE_DECIMAL_BID_FORMAT): Set to 1/0 to say + whether we are using the BID decimal format. + * configure: Regenerate. + + * c-cppbuiltin.c (c_cpp_builtins): Define __STDC_WANT_DEC_FP__ if + the compiler has decimal floating point enabled. Define + __DECIMAL_BID_FORMAT__ if BID decimal floating point is used + instead of DPD. + + * doc/install.texi (--enable-decimal-float): Document BID and DPD + options, and that it is enabled for i386/x86_64 systems. + + * Makefile.in (enable_decimal_float): New. + (DECNUMFMT): New. + (DECNUMINC): Add -I$(DECNUMFMT). + (DECNUM_H): Mov decimal32.h, decimal64.h and decimal128.h + to $(DECNUMFMT) from $(DECNUM). + + * configure.ac: Support * --enable-decimal-float={no,yes,bid,dpd}. + Substitute enable_decimal_float. + * configure: Regenerated. + + PR other/30529 + * config/dfp-bit.c (__dec_byte_swap): Use uint32_t instead of + unsigned long. + + * configure.ac: Enable decimal float for x86_64-*-linux*. + * configure: Regenerated. + + PR other/30530 + * dfp.c (decimal_real_arithmetic): Use decimal128FlipSign and + decimal128ClearSign to flip and clear the sign bit in decimal128. + (decimal_real_maxval): Set decimal128SetSign to set the sign + bit in decimal128. + 2007-03-23 Ian Lance Taylor <iant@google.com> * fold-const.c (fold_binary): Correct warning for X - c >= X. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index dc9d846..ea6255f 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -289,8 +289,10 @@ CPPLIB = ../libcpp/libcpp.a CPPINC = -I$(srcdir)/../libcpp/include # Where to find decNumber +enable_decimal_float = @enable_decimal_float@ DECNUM = $(srcdir)/../libdecnumber -DECNUMINC = -I$(DECNUM) -I../libdecnumber +DECNUMFMT = $(srcdir)/../libdecnumber/$(enable_decimal_float) +DECNUMINC = -I$(DECNUM) -I$(DECNUMFMT) -I../libdecnumber LIBDECNUMBER = ../libdecnumber/libdecnumber.a # Substitution type for target's getgroups 2nd arg. @@ -770,7 +772,7 @@ PREDICT_H = predict.h predict.def CPPLIB_H = $(srcdir)/../libcpp/include/line-map.h \ $(srcdir)/../libcpp/include/cpplib.h DECNUM_H = $(DECNUM)/decContext.h $(DECNUM)/decDPD.h $(DECNUM)/decNumber.h \ - $(DECNUM)/decimal32.h $(DECNUM)/decimal64.h $(DECNUM)/decimal128.h + $(DECNUMFMT)/decimal32.h $(DECNUMFMT)/decimal64.h $(DECNUMFMT)/decimal128.h MKDEPS_H = $(srcdir)/../libcpp/include/mkdeps.h SYMTAB_H = $(srcdir)/../libcpp/include/symtab.h CPP_ID_DATA_H = $(CPPLIB_H) $(srcdir)/../libcpp/include/cpp-id-data.h diff --git a/gcc/c-cppbuiltin.c b/gcc/c-cppbuiltin.c index e9f608e..d27b96b 100644 --- a/gcc/c-cppbuiltin.c +++ b/gcc/c-cppbuiltin.c @@ -605,6 +605,17 @@ c_cpp_builtins (cpp_reader *pfile) new appearance would clobber any existing args. */ if (TARGET_DECLSPEC) builtin_define ("__declspec(x)=__attribute__((x))"); + + /* Tell the user whether decimal floating point is supported, + and if it is supported, whether the alternate format (BID) + is used over the standard (DPD) format. */ + + if (ENABLE_DECIMAL_FLOAT) + { + cpp_define (pfile, "__STDC_WANT_DEC_FP__"); + if (ENABLE_DECIMAL_BID_FORMAT) + cpp_define (pfile, "__DECIMAL_BID_FORMAT__"); + } } /* Pass an object-like macro. If it doesn't lie in the user's diff --git a/gcc/config.in b/gcc/config.in index 69f7e9e..7e60a3e 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -52,6 +52,12 @@ #endif +/* Define to 1 to say we are using the BID decimal format */ +#ifndef USED_FOR_TARGET +#undef ENABLE_DECIMAL_BID_FORMAT +#endif + + /* Define if you want fold checked that it never destructs its argument. This is quite expensive. */ #ifndef USED_FOR_TARGET diff --git a/gcc/config/dfp-bit.c b/gcc/config/dfp-bit.c index 2fa8999..af1db16 100644 --- a/gcc/config/dfp-bit.c +++ b/gcc/config/dfp-bit.c @@ -1,5 +1,5 @@ /* This is a software decimal floating point library. - Copyright (C) 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of GCC. @@ -66,7 +66,7 @@ typedef decNumber* (*dfp_unary_func) typedef decNumber* (*dfp_binary_func) (decNumber *, const decNumber *, const decNumber *, decContext *); -extern unsigned long __dec_byte_swap (unsigned long); +extern uint32_t __dec_byte_swap (uint32_t); /* Unary operations. */ diff --git a/gcc/config/dfp-bit.h b/gcc/config/dfp-bit.h index 1bbe156..5238a2b 100644 --- a/gcc/config/dfp-bit.h +++ b/gcc/config/dfp-bit.h @@ -1,5 +1,5 @@ /* Header file for dfp-bit.c. - Copyright (C) 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of GCC. @@ -288,63 +288,69 @@ extern float strtof (const char *, char **); /* Names of arithmetic functions. */ +#if ENABLE_DECIMAL_BID_FORMAT +#define DPD_BID_NAME(DPD,BID) BID +#else +#define DPD_BID_NAME(DPD,BID) DPD +#endif + #if WIDTH == 32 -#define DFP_ADD __addsd3 -#define DFP_SUB __subsd3 -#define DFP_MULTIPLY __mulsd3 -#define DFP_DIVIDE __divsd3 -#define DFP_EQ __eqsd2 -#define DFP_NE __nesd2 -#define DFP_LT __ltsd2 -#define DFP_GT __gtsd2 -#define DFP_LE __lesd2 -#define DFP_GE __gesd2 -#define DFP_UNORD __unordsd2 +#define DFP_ADD DPD_BID_NAME(__dpd_addsd3,__bid_addsd3) +#define DFP_SUB DPD_BID_NAME(__dpd_subsd3,__bid_subsd3) +#define DFP_MULTIPLY DPD_BID_NAME(__dpd_mulsd3,__bid_mulsd3) +#define DFP_DIVIDE DPD_BID_NAME(__dpd_divsd3,__bid_divsd3) +#define DFP_EQ DPD_BID_NAME(__dpd_eqsd2,__bid_eqsd2) +#define DFP_NE DPD_BID_NAME(__dpd_nesd2,__bid_nesd2) +#define DFP_LT DPD_BID_NAME(__dpd_ltsd2,__bid_ltsd2) +#define DFP_GT DPD_BID_NAME(__dpd_gtsd2,__bid_gtsd2) +#define DFP_LE DPD_BID_NAME(__dpd_lesd2,__bid_lesd2) +#define DFP_GE DPD_BID_NAME(__dpd_gesd2,__bid_gesd2) +#define DFP_UNORD DPD_BID_NAME(__dpd_unordsd2,__bid_unordsd2) #elif WIDTH == 64 -#define DFP_ADD __adddd3 -#define DFP_SUB __subdd3 -#define DFP_MULTIPLY __muldd3 -#define DFP_DIVIDE __divdd3 -#define DFP_EQ __eqdd2 -#define DFP_NE __nedd2 -#define DFP_LT __ltdd2 -#define DFP_GT __gtdd2 -#define DFP_LE __ledd2 -#define DFP_GE __gedd2 -#define DFP_UNORD __unorddd2 +#define DFP_ADD DPD_BID_NAME(__dpd_adddd3,__bid_adddd3) +#define DFP_SUB DPD_BID_NAME(__dpd_subdd3,__bid_subdd3) +#define DFP_MULTIPLY DPD_BID_NAME(__dpd_muldd3,__bid_muldd3) +#define DFP_DIVIDE DPD_BID_NAME(__dpd_divdd3,__bid_divdd3) +#define DFP_EQ DPD_BID_NAME(__dpd_eqdd2,__bid_eqdd2) +#define DFP_NE DPD_BID_NAME(__dpd_nedd2,__bid_nedd2) +#define DFP_LT DPD_BID_NAME(__dpd_ltdd2,__bid_ltdd2) +#define DFP_GT DPD_BID_NAME(__dpd_gtdd2,__bid_gtdd2) +#define DFP_LE DPD_BID_NAME(__dpd_ledd2,__bid_ledd2) +#define DFP_GE DPD_BID_NAME(__dpd_gedd2,__bid_gedd2) +#define DFP_UNORD DPD_BID_NAME(__dpd_unorddd2,__bid_unorddd2) #elif WIDTH == 128 -#define DFP_ADD __addtd3 -#define DFP_SUB __subtd3 -#define DFP_MULTIPLY __multd3 -#define DFP_DIVIDE __divtd3 -#define DFP_EQ __eqtd2 -#define DFP_NE __netd2 -#define DFP_LT __lttd2 -#define DFP_GT __gttd2 -#define DFP_LE __letd2 -#define DFP_GE __getd2 -#define DFP_UNORD __unordtd2 +#define DFP_ADD DPD_BID_NAME(__dpd_addtd3,__bid_addtd3) +#define DFP_SUB DPD_BID_NAME(__dpd_subtd3,__bid_subtd3) +#define DFP_MULTIPLY DPD_BID_NAME(__dpd_multd3,__bid_multd3) +#define DFP_DIVIDE DPD_BID_NAME(__dpd_divtd3,__bid_divtd3) +#define DFP_EQ DPD_BID_NAME(__dpd_eqtd2,__bid_eqtd2) +#define DFP_NE DPD_BID_NAME(__dpd_netd2,__bid_netd2) +#define DFP_LT DPD_BID_NAME(__dpd_lttd2,__bid_lttd2) +#define DFP_GT DPD_BID_NAME(__dpd_gttd2,__bid_gttd2) +#define DFP_LE DPD_BID_NAME(__dpd_letd2,__bid_letd2) +#define DFP_GE DPD_BID_NAME(__dpd_getd2,__bid_getd2) +#define DFP_UNORD DPD_BID_NAME(__dpd_unordtd2,__bid_unordtd2) #endif /* Names of functions to convert between different decimal float types. */ #if WIDTH == 32 #if WIDTH_TO == 64 -#define DFP_TO_DFP __extendsddd2 +#define DFP_TO_DFP DPD_BID_NAME(__dpd_extendsddd2,__bid_extendsddd2) #elif WIDTH_TO == 128 -#define DFP_TO_DFP __extendsdtd2 +#define DFP_TO_DFP DPD_BID_NAME(__dpd_extendsdtd2,__bid_extendsdtd2) #endif #elif WIDTH == 64 #if WIDTH_TO == 32 -#define DFP_TO_DFP __truncddsd2 +#define DFP_TO_DFP DPD_BID_NAME(__dpd_truncddsd2,__bid_truncddsd2) #elif WIDTH_TO == 128 -#define DFP_TO_DFP __extendddtd2 +#define DFP_TO_DFP DPD_BID_NAME(__dpd_extendddtd2,__bid_extendddtd2) #endif #elif WIDTH == 128 #if WIDTH_TO == 32 -#define DFP_TO_DFP __trunctdsd2 +#define DFP_TO_DFP DPD_BID_NAME(__dpd_trunctdsd2,__bid_trunctdsd2) #elif WIDTH_TO == 64 -#define DFP_TO_DFP __trunctddd2 +#define DFP_TO_DFP DPD_BID_NAME(__dpd_trunctddd2,__bid_trunctddd2) #endif #endif @@ -352,45 +358,45 @@ extern float strtof (const char *, char **); #if WIDTH == 32 #if INT_KIND == 1 -#define INT_TO_DFP __floatsisd -#define DFP_TO_INT __fixsdsi +#define INT_TO_DFP DPD_BID_NAME(__dpd_floatsisd,__bid_floatsisd) +#define DFP_TO_INT DPD_BID_NAME(__dpd_fixsdsi,__bid_fixsdsi) #elif INT_KIND == 2 -#define INT_TO_DFP __floatdisd -#define DFP_TO_INT __fixsddi +#define INT_TO_DFP DPD_BID_NAME(__dpd_floatdisd,__bid_floatdisd) +#define DFP_TO_INT DPD_BID_NAME(__dpd_fixsddi,__bid_fixsddi) #elif INT_KIND == 3 -#define INT_TO_DFP __floatunssisd -#define DFP_TO_INT __fixunssdsi +#define INT_TO_DFP DPD_BID_NAME(__dpd_floatunssisd,__bid_floatunssisd) +#define DFP_TO_INT DPD_BID_NAME(__dpd_fixunssdsi,__bid_fixunssdsi) #elif INT_KIND == 4 -#define INT_TO_DFP __floatunsdisd -#define DFP_TO_INT __fixunssddi +#define INT_TO_DFP DPD_BID_NAME(__dpd_floatunsdisd,__bid_floatunsdisd) +#define DFP_TO_INT DPD_BID_NAME(__dpd_fixunssddi,__bid_fixunssddi) #endif #elif WIDTH == 64 #if INT_KIND == 1 -#define INT_TO_DFP __floatsidd -#define DFP_TO_INT __fixddsi +#define INT_TO_DFP DPD_BID_NAME(__dpd_floatsidd,__bid_floatsidd) +#define DFP_TO_INT DPD_BID_NAME(__dpd_fixddsi,__bid_fixddsi) #elif INT_KIND == 2 -#define INT_TO_DFP __floatdidd -#define DFP_TO_INT __fixdddi +#define INT_TO_DFP DPD_BID_NAME(__dpd_floatdidd,__bid_floatdidd) +#define DFP_TO_INT DPD_BID_NAME(__dpd_fixdddi,__bid_fixdddi) #elif INT_KIND == 3 -#define INT_TO_DFP __floatunssidd -#define DFP_TO_INT __fixunsddsi +#define INT_TO_DFP DPD_BID_NAME(__dpd_floatunssidd,__bid_floatunssidd) +#define DFP_TO_INT DPD_BID_NAME(__dpd_fixunsddsi,__bid_fixunsddsi) #elif INT_KIND == 4 -#define INT_TO_DFP __floatunsdidd -#define DFP_TO_INT __fixunsdddi +#define INT_TO_DFP DPD_BID_NAME(__dpd_floatunsdidd,__bid_floatunsdidd) +#define DFP_TO_INT DPD_BID_NAME(__dpd_fixunsdddi,__bid_fixunsdddi) #endif #elif WIDTH == 128 #if INT_KIND == 1 -#define INT_TO_DFP __floatsitd -#define DFP_TO_INT __fixtdsi +#define INT_TO_DFP DPD_BID_NAME(__dpd_floatsitd,__bid_floatsitd) +#define DFP_TO_INT DPD_BID_NAME(__dpd_fixtdsi,__bid_fixtdsi) #elif INT_KIND == 2 -#define INT_TO_DFP __floatditd -#define DFP_TO_INT __fixtddi +#define INT_TO_DFP DPD_BID_NAME(__dpd_floatditd,__bid_floatditd) +#define DFP_TO_INT DPD_BID_NAME(__dpd_fixtddi,__bid_fixtddi) #elif INT_KIND == 3 -#define INT_TO_DFP __floatunssitd -#define DFP_TO_INT __fixunstdsi +#define INT_TO_DFP DPD_BID_NAME(__dpd_floatunssitd,__bid_floatunssitd) +#define DFP_TO_INT DPD_BID_NAME(__dpd_fixunstdsi,__bid_fixunstdsi) #elif INT_KIND == 4 -#define INT_TO_DFP __floatunsditd -#define DFP_TO_INT __fixunstddi +#define INT_TO_DFP DPD_BID_NAME(__dpd_floatunsditd,__bid_floatunsditd) +#define DFP_TO_INT DPD_BID_NAME(__dpd_fixunstddi,__bid_fixunstddi) #endif #endif @@ -398,38 +404,38 @@ extern float strtof (const char *, char **); #if WIDTH == 32 #if BFP_KIND == 1 -#define BFP_TO_DFP __extendsfsd -#define DFP_TO_BFP __truncsdsf +#define BFP_TO_DFP DPD_BID_NAME(__dpd_extendsfsd,__bid_extendsfsd) +#define DFP_TO_BFP DPD_BID_NAME(__dpd_truncsdsf,__bid_truncsdsf) #elif BFP_KIND == 2 -#define BFP_TO_DFP __truncdfsd -#define DFP_TO_BFP __extendsddf +#define BFP_TO_DFP DPD_BID_NAME(__dpd_truncdfsd,__bid_truncdfsd) +#define DFP_TO_BFP DPD_BID_NAME(__dpd_extendsddf,__bid_extendsddf) #elif BFP_KIND == 3 -#define BFP_TO_DFP __truncxfsd -#define DFP_TO_BFP __extendsdxf +#define BFP_TO_DFP DPD_BID_NAME(__dpd_truncxfsd,__bid_truncxfsd) +#define DFP_TO_BFP DPD_BID_NAME(__dpd_extendsdxf,__bid_extendsdxf) #endif /* BFP_KIND */ #elif WIDTH == 64 #if BFP_KIND == 1 -#define BFP_TO_DFP __extendsfdd -#define DFP_TO_BFP __truncddsf +#define BFP_TO_DFP DPD_BID_NAME(__dpd_extendsfdd,__bid_extendsfdd) +#define DFP_TO_BFP DPD_BID_NAME(__dpd_truncddsf,__bid_truncddsf) #elif BFP_KIND == 2 -#define BFP_TO_DFP __extenddfdd -#define DFP_TO_BFP __truncdddf +#define BFP_TO_DFP DPD_BID_NAME(__dpd_extenddfdd,__bid_extenddfdd) +#define DFP_TO_BFP DPD_BID_NAME(__dpd_truncdddf,__bid_truncdddf) #elif BFP_KIND == 3 -#define BFP_TO_DFP __truncxfdd -#define DFP_TO_BFP __extendddxf +#define BFP_TO_DFP DPD_BID_NAME(__dpd_truncxfdd,__bid_truncxfdd) +#define DFP_TO_BFP DPD_BID_NAME(__dpd_extendddxf,__bid_extendddxf) #endif /* BFP_KIND */ #elif WIDTH == 128 #if BFP_KIND == 1 -#define BFP_TO_DFP __extendsftd -#define DFP_TO_BFP __trunctdsf +#define BFP_TO_DFP DPD_BID_NAME(__dpd_extendsftd,__bid_extendsftd) +#define DFP_TO_BFP DPD_BID_NAME(__dpd_trunctdsf,__bid_trunctdsf) #elif BFP_KIND == 2 -#define BFP_TO_DFP __extenddftd -#define DFP_TO_BFP __trunctddf +#define BFP_TO_DFP DPD_BID_NAME(__dpd_extenddftd,__bid_extenddftd) +#define DFP_TO_BFP DPD_BID_NAME(__dpd_trunctddf,__bid_trunctddf) #elif BFP_KIND == 3 -#define BFP_TO_DFP __extendxftd -#define DFP_TO_BFP __trunctdxf +#define BFP_TO_DFP DPD_BID_NAME(__dpd_extendxftd,__bid_extendxftd) +#define DFP_TO_BFP DPD_BID_NAME(__dpd_trunctdxf,__bid_trunctdxf) #endif /* BFP_KIND */ #endif /* WIDTH */ diff --git a/gcc/configure b/gcc/configure index 0cecbcd..627c946 100755 --- a/gcc/configure +++ b/gcc/configure @@ -879,7 +879,10 @@ Optional Features: --enable-gather-detailed-mem-stats enable detailed memory allocation stats gathering --enable-multilib enable library support for multiple ABIs --enable-__cxa_atexit enable __cxa_atexit for C++ - --enable-decimal-float enable decimal float extension to 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-threads enable thread usage for target GCC --enable-threads=LIB use LIB thread package for target GCC --enable-tls enable or disable generation of tls code @@ -7012,9 +7015,19 @@ fi; if test "${enable_decimal_float+set}" = set; then enableval="$enable_decimal_float" - if test x$enablevar = xyes ; then - case $target in - powerpc*-*-linux* | i?86*-*-linux*) + case $enable_decimal_float in + yes | no | bid | dpd) ;; + *) { { echo "$as_me:$LINENO: error: '$enable_decimal_float' is an invalid value for --enable-decimal-float. +Valid choices are 'yes', 'bid', 'dpd', and 'no'." >&5 +echo "$as_me: error: '$enable_decimal_float' is an invalid value for --enable-decimal-float. +Valid choices are 'yes', 'bid', 'dpd', and 'no'." >&2;} + { (exit 1); exit 1; }; } ;; + esac + +else + + case $target in + powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux*) enable_decimal_float=yes ;; *) @@ -7022,19 +7035,41 @@ if test "${enable_decimal_float+set}" = set; then echo "$as_me: WARNING: decimal float is not supported for this target" >&2;} enable_decimal_float=no ;; - esac - fi + esac -else - enable_decimal_float=no 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 -dfp=`if test $enable_decimal_float = yes; then echo 1; else echo 0; fi` + +# 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 + + +bid=`if test $enable_decimal_float = bid; then echo 1; else echo 0; fi` cat >>confdefs.h <<_ACEOF -#define ENABLE_DECIMAL_FLOAT $dfp +#define ENABLE_DECIMAL_BID_FORMAT $bid _ACEOF @@ -7630,7 +7665,7 @@ if test "${gcc_cv_prog_makeinfo_modern+set}" = set; then else ac_prog_version=`$MAKEINFO --version 2>&1 | sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'` - echo "configure:7633: version of makeinfo is $ac_prog_version" >&5 + echo "configure:7668: version of makeinfo is $ac_prog_version" >&5 case $ac_prog_version in '') gcc_cv_prog_makeinfo_modern=no;; 4.[4-9]*) diff --git a/gcc/configure.ac b/gcc/configure.ac index f3a6236..226b62a 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -667,27 +667,58 @@ AC_ARG_ENABLE(__cxa_atexit, # Enable C extension for decimal float if target supports it. AC_ARG_ENABLE(decimal-float, -[ --enable-decimal-float enable decimal float extension to 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], [ - if test x$enablevar = xyes ; then - case $target in - powerpc*-*-linux* | i?86*-*-linux*) + 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 - fi -], [enable_decimal_float=no]) - -AC_SUBST(enable_decimal_float) + esac +]) -dfp=`if test $enable_decimal_float = yes; then echo 1; else echo 0; fi` +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 threads # Pass with no value to take the default # Pass with a value to specify a thread package @@ -1,5 +1,5 @@ /* Decimal floating point support. - Copyright (C) 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of GCC. @@ -656,11 +656,9 @@ decimal_real_arithmetic (REAL_VALUE_TYPE *r, enum tree_code code, case NEGATE_EXPR: { - decimal128 *d128; *r = *op0; - d128 = (decimal128 *) r->sig; - /* Flip high bit. */ - d128->bytes[0] ^= 1 << 7; + /* Flip sign bit. */ + decimal128FlipSign ((decimal128 *) r->sig); /* Keep sign field in sync. */ r->sign ^= 1; } @@ -668,11 +666,9 @@ decimal_real_arithmetic (REAL_VALUE_TYPE *r, enum tree_code code, case ABS_EXPR: { - decimal128 *d128; *r = *op0; - d128 = (decimal128 *) r->sig; - /* Clear high bit. */ - d128->bytes[0] &= 0x7f; + /* Clear sign bit. */ + decimal128ClearSign ((decimal128 *) r->sig); /* Keep sign field in sync. */ r->sign = 0; } @@ -712,5 +708,5 @@ decimal_real_maxval (REAL_VALUE_TYPE *r, int sign, enum machine_mode mode) decimal_real_from_string (r, max); if (sign) - r->sig[0] |= 0x80000000; + decimal128SetSign ((decimal128 *) r->sig, 1); } diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 569a399..76545c0 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -1304,11 +1304,20 @@ is removed entirely in the next major release, unless someone steps forward to maintain the port. @item --enable-decimal-float +@itemx --enable-decimal-float=yes +@itemx --enable-decimal-float=no +@itemx --enable-decimal-float=bid +@itemx --enable-decimal-float=dpd @itemx --disable-decimal-float -Enable (or disable) support for the C decimal floating point -extension. This is enabled by default only on PowerPC GNU/Linux -systems. Other systems may also support it, but require the user to -specifically enable it. +Enable (or disable) support for the C decimal floating point extension +that is in the IEEE 754R extension to the IEEE754 floating point +standard. This is enabled by default only on PowerPC, i386, and +x86_64 GNU/Linux systems. Other systems may also support it, but +require the user to specifically enable it. You can optionally +control which decimal floating point format is used (either @samp{bid} +or @samp{dpd}). The @samp{bid} (binary integer decimal) format is +default on i386 and x86_64 systems, and the @samp{dpd} (densely packed +decimal) format is default on PowerPC systems. @item --with-long-double-128 Specify if @code{long double} type should be 128-bit by default on selected diff --git a/gcc/optabs.c b/gcc/optabs.c index 51c84c8..94e3691 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -130,6 +130,14 @@ static rtx vector_compare_rtx (tree, bool, enum insn_code); #define HAVE_conditional_trap 0 #define gen_conditional_trap(a,b) (gcc_unreachable (), NULL_RTX) #endif + +/* Prefixes for the current version of decimal floating point (BID vs. DPD) */ +#if ENABLE_DECIMAL_BID_FORMAT +#define DECIMAL_PREFIX "bid_" +#else +#define DECIMAL_PREFIX "dpd_" +#endif + /* Add a REG_EQUAL note to the last insn in INSNS. TARGET is being set to the result of operation CODE applied to OP0 (and OP1 if it is a binary @@ -5177,9 +5185,16 @@ init_integral_libfuncs (optab optable, const char *opname, int suffix) static void init_floating_libfuncs (optab optable, const char *opname, int suffix) { + char *dec_opname = alloca (sizeof (DECIMAL_PREFIX) + strlen (opname)); + + /* For BID support, change the name to have either a bid_ or dpd_ prefix + depending on the low level floating format used. */ + memcpy (dec_opname, DECIMAL_PREFIX, sizeof (DECIMAL_PREFIX) - 1); + strcpy (dec_opname + sizeof (DECIMAL_PREFIX) - 1, opname); + init_libfuncs (optable, MIN_MODE_FLOAT, MAX_MODE_FLOAT, opname, suffix); init_libfuncs (optable, MIN_MODE_DECIMAL_FLOAT, MAX_MODE_DECIMAL_FLOAT, - opname, suffix); + dec_opname, suffix); } /* Initialize the libfunc fields of an entire group of entries of an @@ -5201,8 +5216,13 @@ init_interclass_conv_libfuncs (convert_optab tab, const char *opname, const char *fname, *tname; const char *q; char *libfunc_name, *suffix; + char *nondec_name, *dec_name, *nondec_suffix, *dec_suffix; char *p; + /* If this is a decimal conversion, add the current BID vs. DPD prefix that + depends on which underlying decimal floating point format is used. */ + const size_t dec_len = sizeof (DECIMAL_PREFIX) - 1; + for (fmode = first_from_mode; fmode != VOIDmode; fmode = GET_MODE_WIDER_MODE (fmode)) @@ -5213,11 +5233,18 @@ init_interclass_conv_libfuncs (convert_optab tab, const char *opname, tmode = GET_MODE_WIDER_MODE (tmode)) max_mname_len = MAX (max_mname_len, strlen (GET_MODE_NAME (tmode))); - libfunc_name = alloca (2 + opname_len + 2*max_mname_len + 1 + 1); - libfunc_name[0] = '_'; - libfunc_name[1] = '_'; - memcpy (&libfunc_name[2], opname, opname_len); - suffix = libfunc_name + opname_len + 2; + nondec_name = alloca (2 + opname_len + 2*max_mname_len + 1 + 1); + nondec_name[0] = '_'; + nondec_name[1] = '_'; + memcpy (&nondec_name[2], opname, opname_len); + nondec_suffix = nondec_name + opname_len + 2; + + dec_name = alloca (2 + dec_len + opname_len + 2*max_mname_len + 1 + 1); + dec_name[0] = '_'; + dec_name[1] = '_'; + memcpy (&dec_name[2], DECIMAL_PREFIX, dec_len); + memcpy (&dec_name[2+dec_len], opname, opname_len); + dec_suffix = dec_name + dec_len + opname_len + 2; for (fmode = first_from_mode; fmode != VOIDmode; fmode = GET_MODE_WIDER_MODE (fmode)) @@ -5227,6 +5254,17 @@ init_interclass_conv_libfuncs (convert_optab tab, const char *opname, fname = GET_MODE_NAME (fmode); tname = GET_MODE_NAME (tmode); + if (DECIMAL_FLOAT_MODE_P(fmode) || DECIMAL_FLOAT_MODE_P(tmode)) + { + libfunc_name = dec_name; + suffix = dec_suffix; + } + else + { + libfunc_name = nondec_name; + suffix = nondec_suffix; + } + p = suffix; for (q = fname; *q; p++, q++) *p = TOLOWER (*q); @@ -5257,18 +5295,30 @@ init_intraclass_conv_libfuncs (convert_optab tab, const char *opname, enum machine_mode nmode, wmode; const char *nname, *wname; const char *q; + char *nondec_name, *dec_name, *nondec_suffix, *dec_suffix; char *libfunc_name, *suffix; char *p; + /* If this is a decimal conversion, add the current BID vs. DPD prefix that + depends on which underlying decimal floating point format is used. */ + const size_t dec_len = sizeof (DECIMAL_PREFIX) - 1; + for (nmode = first_mode; nmode != VOIDmode; nmode = GET_MODE_WIDER_MODE (nmode)) max_mname_len = MAX (max_mname_len, strlen (GET_MODE_NAME (nmode))); - libfunc_name = alloca (2 + opname_len + 2*max_mname_len + 1 + 1); - libfunc_name[0] = '_'; - libfunc_name[1] = '_'; - memcpy (&libfunc_name[2], opname, opname_len); - suffix = libfunc_name + opname_len + 2; + nondec_name = alloca (2 + opname_len + 2*max_mname_len + 1 + 1); + nondec_name[0] = '_'; + nondec_name[1] = '_'; + memcpy (&nondec_name[2], opname, opname_len); + nondec_suffix = nondec_name + opname_len + 2; + + dec_name = alloca (2 + dec_len + opname_len + 2*max_mname_len + 1 + 1); + dec_name[0] = '_'; + dec_name[1] = '_'; + memcpy (&dec_name[2], DECIMAL_PREFIX, dec_len); + memcpy (&dec_name[2 + dec_len], opname, opname_len); + dec_suffix = dec_name + dec_len + opname_len + 2; for (nmode = first_mode; nmode != VOIDmode; nmode = GET_MODE_WIDER_MODE (nmode)) @@ -5278,6 +5328,17 @@ init_intraclass_conv_libfuncs (convert_optab tab, const char *opname, nname = GET_MODE_NAME (nmode); wname = GET_MODE_NAME (wmode); + if (DECIMAL_FLOAT_MODE_P(nmode) || DECIMAL_FLOAT_MODE_P(wmode)) + { + libfunc_name = dec_name; + suffix = dec_suffix; + } + else + { + libfunc_name = nondec_name; + suffix = nondec_suffix; + } + p = suffix; for (q = widening ? nname : wname; *q; p++, q++) *p = TOLOWER (*q); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b5049ac..39365b7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2007-03-23 Michael Meissner <michael.meissner@amd.com> + + * gcc.dg/dfp/convert-dfp.c: Wrap __STDC_WANT_DEC_FP__ with + #ifndef/#endif. + * gcc.dg/dfp/convert-int-saturate.c: Ditto. + * gcc.dg/dfp/decfloat-constants.c: Ditto. + 2007-03-24 Paul Thomas <pault@gcc.gnu.org> PR fortran/31209 diff --git a/gcc/testsuite/gcc.dg/dfp/convert-dfp.c b/gcc/testsuite/gcc.dg/dfp/convert-dfp.c index 5afdcf0..b84e67d 100644 --- a/gcc/testsuite/gcc.dg/dfp/convert-dfp.c +++ b/gcc/testsuite/gcc.dg/dfp/convert-dfp.c @@ -6,7 +6,10 @@ Test various conversions involving decimal floating types. */ +#ifndef __STDC_WANT_DEC_FP__ #define __STDC_WANT_DEC_FP__ 1 +#endif + #include <float.h> extern void abort (void); diff --git a/gcc/testsuite/gcc.dg/dfp/convert-int-saturate.c b/gcc/testsuite/gcc.dg/dfp/convert-int-saturate.c index aeaa465..ab4c8d2 100644 --- a/gcc/testsuite/gcc.dg/dfp/convert-int-saturate.c +++ b/gcc/testsuite/gcc.dg/dfp/convert-int-saturate.c @@ -4,7 +4,10 @@ C99 6.3.1.4(1a) New. Test integer saturation. */ +#ifndef __STDC_WANT_DEC_FP__ #define __STDC_WANT_DEC_FP__ 1 +#endif + #include <float.h> #include <limits.h> diff --git a/gcc/testsuite/gcc.dg/dfp/decfloat-constants.c b/gcc/testsuite/gcc.dg/dfp/decfloat-constants.c index 4980c65..87c9849 100644 --- a/gcc/testsuite/gcc.dg/dfp/decfloat-constants.c +++ b/gcc/testsuite/gcc.dg/dfp/decfloat-constants.c @@ -7,7 +7,10 @@ decimal float defined in float.h. */ /* Make sure we are exporting the right values to float.h. */ +#ifndef __STDC_WANT_DEC_FP__ #define __STDC_WANT_DEC_FP__ 1 +#endif + #include <float.h> extern void abort (void); |