Committed: Add BID (Binary Integer Decimal) support to GCC

Michael Meissner michael.meissner@amd.com
Sat Mar 24 18:45:00 GMT 2007


I've submitted the patches for adding optional BID (Binary Integer Decimal)
support to GCC before and incorported the changes that came from the previous
comment.  This patch enables BID as the default decimal floating point format
on x86/x86_64 Linux systems, and leaves the original DPD format for the powerpc
and power systems.  In terms of testing, I did the usual bootstrap build on my
x86_64 Fedora core 6 system, building with the default option, and with the
--enable-decimal-float={dpd|no} options.  I ran the regression tests, and there
were no regressions from the unpatched sources.  I also did some unit tests to
make sure the correct format was used.  Unfortunately I had to bzip the patch
to get it under the mailer size limits due to moving the libdecnumber sources
to a dpd subdirectory.

gcc/

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.

gcc/testsuite

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.

libdecnumber/

2007-03-23  Michael Meissner  <michael.meissner@amd.com>
	    H.J. Lu  <hongjiu.lu@intel.com>
	    Marius Cornea  <marius.cornea@intel.com>

	* Makefile.in (enable_decimal_float): New.
	(libdecnumber_a_OBJS): Add bid2dpd_dpd2bid.o, host-ieee32.o,
	host-ieee64.o and host-ieee128.o for BID.
	(libdecnumber_a_SOURCES): Support DPD and BID.
	(decimal32.o): Support dependency for both DPD and BID.
	(decimal64.o): Likewise.
	(decimal128.o): Likewise.
	(bid2dpd_dpd2bid.o): New target.
	(host-ieee32.o): Likewise.
	(host-ieee64.o): Likewise.
	(host-ieee128.o): Likewise.

	* bid/bid-dpd.h: New file.
	* bid/decimal128.c: Likewise.
	* bid/decimal128.h: Likewise.
	* bid/decimal32.c: Likewise.
	* bid/decimal32.h: Likewise.
	* bid/decimal64.c: Likewise.
	* bid/decimal64.h: Likewise.
	* bid/host-ieee128.c: Likewise.
	* bid/host-ieee32.c: Likewise.
	* bid/host-ieee64.c: Likewise.
	* bid/bid2dpd_dpd2bid.c: Likewise.
	* bid/bid2dpd_dpd2bid.h: Likewise.

	* decimal128.c: Moved to ...
	* dpd/decimal128.c: This.
	* decimal128.h:  Moved to ...
	* dpd/decimal128.h: This.
	* decimal32.c: Moved to ...
	* dpd/decimal32.c: This.
	* decimal32.h: Moved to ...
	* dpd/decimal32.h: This.
	* decimal64.c: Moved to ...
	* dpd/decimal64.c: This.
	* decimal64.h: Moved to ...
	* dpd/decimal64.h: This.

	* configure.ac: Support * --enable-decimal-float={no,yes,bid,dpd}.
	Add AC_C_BIGENDIAN.  Substitute enable_decimal_float.
	* config.in: Add decimal support variables.
	* configure: Regenerate.

	PR other/30530
	* decimal128.h (decimal128ClearSign): New.
	(decimal128FlipSign): Likewise.

	* decimal32.h: (decimal32ClearSign): New.
	(decimal32FlipSign): Likewise.

	* decimal64.h (decimal64ClearSign): New.
	(decimal64FlipSign): Likewise.

libgcc/

2007-03-23  Michael Meissner  <michael.meissner@amd.com>
	    H.J. Lu  <hongjiu.lu@intel.com>

	* Makefile.in (enable_decimal_float): New.
	(DECNUMINC): Add
	-I$(srcdir)/../libdecnumber/$(enable_decimal_float).
	(dec-objects): Move decimal32, decimal64 and decimal128 to ...
	(decbits-filenames): This.
	(decbits-objects): New.
	(libgcc-objects): Add $(decbits-objects).

	* configure.ac: Support * --enable-decimal-float={no,yes,bid,dpd}.
	Substitute enable_decimal_float.
	* configure: Regenerated.


-- 
Michael Meissner, AMD
90 Central Street, MS 83-29, Boxborough, MA, 01719, USA
michael.meissner@amd.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: decimal.patch11b.bz2
Type: application/x-bzip2
Size: 46505 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070324/617e6207/attachment.bz2>


More information about the Gcc-patches mailing list