This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: last DFP patch


This patch completes the libgcc changes for decimal floating point
support.  It allows users to include the DFP arithmetic routines in
libgcc on selected targets (x86, x86-64 and PowerPC GNU/Linux) when
GCC is configured with --enable-decimal-float.

Tested on the selected targets mentioned above (and one or two others)
with a bootstrap and regression test run, with and without
--enable-decimal-float.  Okay for the trunk?

Ben

2006-02-28  Ben Elliston  <bje@au.ibm.com>

	* config.gcc: Include t-dfprules in $tmake_file for i?86-*-linux*,
	powerpc-*-linux* and powerpc64-*-linux* configurations.
	* mklibgcc.in: Add logic to handle $DFP_ENABLE and $DFP_CFLAGS.
	Compile dfp-bit.c from the source directory using -DWIDTH and
	$DFP_CFLAGS to control the compilation of that file, rather than
	generating width-specific versions in the build directory.
	* Makefile.in (libgcc.mk): Pass down DFP_ENABLE and DFP_CFLAGS.
	(LIBGCC_DEPS): Replace $(D32PBIT) et al with config/dfp-bit.[hc].
	* config/t-dfprules: New file.
	* config/i386/t-linux64 (DFP_ENABLE, DFP_CFLAGS): Define.

Index: mklibgcc.in
===================================================================
--- mklibgcc.in	(revision 111508)
+++ mklibgcc.in	(working copy)
@@ -25,6 +25,8 @@
 # FPBIT
 # FPBIT_FUNCS
 # LIB2_DIVMOD_FUNCS
+# DFP_ENABLE
+# DFP_CFLAGS
 # DPBIT
 # DPBIT_FUNCS
 # TPBIT
@@ -368,6 +370,11 @@ for ml in $MULTILIBS; do
   done
 
   if [ "@enable_decimal_float@" = "yes" -a -z "$libgcc_so" ]; then
+    # If $DFP_ENABLE is set, then we want all data type sizes.
+    if [ "$DFP_ENABLE" ] ; then
+	D32PBIT=1; D64PBIT=1; D128PBIT=1
+    fi
+
     # Bring in the DFP support code if D32PBIT, D64PBIT or D128PBIT are set.
     if [ -n "$D32PBIT" -o -n "$D64PBIT" -o -n "$D128PBIT" ] ; then
       dec_filenames="decContext decNumber decRound decLibrary decUtility"
@@ -396,14 +403,18 @@ for ml in $MULTILIBS; do
       dpfuncs_var="${dpbit_var}_FUNCS"
       eval dpbit=\$$dpbit_var
       eval dpfuncs=\$$dpfuncs_var
+      case "$dpbit_var" in
+	  D32PBIT)  dpwidth=32 ;;
+	  D64PBIT)  dpwidth=64 ;;
+	  D128PBIT) dpwidth=128 ;;
+      esac
 
       if [ "$dpbit" ]; then
         for name in $dpfuncs; do
           out="libgcc/${dir}/${name}${objext}"
-	  echo $out: $dpbit $fpbit_c_dep
-	  echo "	$gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name \
-	    -c $dpbit -o $out
-
+	  echo $out: config/dfp-bit.c $fpbit_c_dep
+	  echo "	$gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name -DWIDTH=$dpwidth \
+	      $DFP_CFLAGS -c $\(srcdir\)/config/dfp-bit.c -o $out
 	  echo $libgcc_a: $out
         done
       fi
Index: config.gcc
===================================================================
--- config.gcc	(revision 111508)
+++ config.gcc	(working copy)
@@ -1060,7 +1060,7 @@ i[34567]86-*-linux* | i[34567]86-*-kfree
 	i[34567]86-*-knetbsd*-gnu) tm_file="${tm_file} knetbsd-gnu.h i386/knetbsd-gnu.h" ;;
 	i[34567]86-*-kfreebsd*-gnu) tm_file="${tm_file} kfreebsd-gnu.h i386/kfreebsd-gnu.h" ;;
 	esac
-	tmake_file="${tmake_file} i386/t-crtstuff i386/t-crtfm"
+	tmake_file="${tmake_file} i386/t-crtstuff i386/t-crtfm t-dfprules"
 	;;
 x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
 	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h linux.h \
@@ -1636,7 +1636,7 @@ powerpc64-*-linux*)
 		tm_file="rs6000/secureplt.h ${tm_file}"
 	fi
 	extra_options="${extra_options} rs6000/sysv4.opt rs6000/linux64.opt"
-	tmake_file="rs6000/t-fprules ${tmake_file} rs6000/t-ppccomm rs6000/t-linux64"
+	tmake_file="t-dfprules rs6000/t-fprules ${tmake_file} rs6000/t-ppccomm rs6000/t-linux64"
 	;;
 powerpc64-*-gnu*)
 	tm_file="${cpu_type}/${cpu_type}.h elfos.h svr4.h freebsd-spec.h gnu.h rs6000/sysv4.h rs6000/linux64.h rs6000/gnu.h"
@@ -1734,7 +1734,7 @@ powerpc-*-linux*spe*)
 powerpc-*-linux*)
 	tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h"
 	extra_options="${extra_options} rs6000/sysv4.opt"
-	tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm"
+	tmake_file="t-dfprules rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm"
 	case ${enable_targets}:${cpu_is_64bit} in
 	    *powerpc64* | all:* | *:yes)
 		if test x$cpu_is_64bit = xyes; then
Index: Makefile.in
===================================================================
--- Makefile.in	(revision 111508)
+++ Makefile.in	(working copy)
@@ -1415,6 +1415,8 @@ libgcc.mk: config.status Makefile mklibg
 	DPBIT_FUNCS='$(DPBIT_FUNCS)' \
 	TPBIT='$(TPBIT)' \
 	TPBIT_FUNCS='$(TPBIT_FUNCS)' \
+	DFP_ENABLE='$(DFP_ENABLE)' \
+	DFP_CFLAGS='$(DFP_CFLAGS)' \
 	D32PBIT='$(D32PBIT)' \
 	D32PBIT_FUNCS='$(D32PBIT_FUNCS)' \
 	D64PBIT='$(D64PBIT)' \
@@ -1443,7 +1445,7 @@ LIBGCC_DEPS = $(GCC_PASSES) $(LANGUAGES)
 	libgcc.mk $(srcdir)/libgcc2.c $(srcdir)/libgcov.c $(TCONFIG_H) \
 	$(MACHMODE_H) longlong.h gbl-ctors.h config.status $(srcdir)/libgcc2.h \
 	tsystem.h $(FPBIT) $(DPBIT) $(TPBIT) $(LIB2ADD) \
-	$(D32PBIT) $(D64PBIT) $(D128PBIT) \
+	config/dfp-bit.h config/dfp-bit.c \
 	$(LIB2ADD_ST) $(LIB2ADDEH) $(LIB2ADDEHDEP) $(EXTRA_PARTS) \
 	$(srcdir)/config/$(LIB1ASMSRC) \
 	$(srcdir)/gcov-io.h $(srcdir)/gcov-io.c gcov-iov.h
Index: config/t-dfprules
===================================================================
--- config/t-dfprules	(revision 0)
+++ config/t-dfprules	(revision 0)
@@ -0,0 +1,11 @@
+# Use DFP_ENABLE to build decimal floating point support routines for
+# all decimal floating point types (32-bit, 64-bit and 128-bit). We
+# use `true' for clarity, but any value will do.
+#
+DFP_ENABLE = true
+
+# DFP_CFLAGS can be used to pass target-specific CFLAGS when compiling
+# dfp-bit.c.  This is useful for overriding the definition of CMPtype
+# and other macros.
+#
+# DFP_CFLAGS = -DFOO=bar
Index: config/i386/t-linux64
===================================================================
--- config/i386/t-linux64	(revision 111508)
+++ config/i386/t-linux64	(working copy)
@@ -19,3 +19,8 @@ EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o
 # because then __FRAME_END__ might not be the last thing in .eh_frame
 # section.
 CRTSTUFF_T_CFLAGS = -fno-omit-frame-pointer -fno-asynchronous-unwind-tables
+
+# Build decimal floating point support routines.
+
+DFP_ENABLE = true
+DFP_CFLAGS = -DCMPtype=DItype


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]