[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r9438 - in /libdfp/trunk: ./ autom4te.cache/ ieee754r/ sysdeps/bid/ sysdeps/dpd/ sysdeps/powerpc/dfpu/ sysdeps/s390/dfpu/ sy...



Author: ryanarn
Date: Wed Dec  9 14:57:47 2009
New Revision: 9438

Log:
2009-12-09  Ryan S. Arnold  <rsa@xxxxxxxxxx>

	* configure: Regenerated.
	* Makefile.in (.c.o, .c.os): Added -include $(top_builddir)/config.h to
	pick up _BACKEND_DPD or _BACKEND_BID.
	($(top_builddir)/$(STATIC_LIBRARY)): Add $(top_builddir) to
	dfp_backend path.
	* README: Added WARNING about making sure to link to a glibc that's
	the same bitness (32|64) and the same optimization as the libdfp
	that's being configure.  Added --with-glibc-build= examples.
	* Versions (libdfp): LIBDFP_1.0.0 tagged.
	* Versions.def (libdfp): LIBDFP_1.0.0 tagged.
	* ieee754r/Versions.def (libdfp): LIBDFP_1.0.0 tagged.
	* config.h.in: Regenerated.
	* configure.ac: (AC_INIT): Tagged version 1.0.0.
	(_DPD_BACKEND): AC_DEFINE_UNQUOTED; Set based on backend.
	(_BID_BACKEND): AC_DEFINE_UNQUOTED; Set based on backend.
	(--with-cpu): Removed submachine_opt="-mcpu=$withval".
	($machine): On s390 cc_msize=31 NOT 32.
	(AC_SUBST): CFLAGS and ASFLAGS.
	(AC_CACHE_CHECK): Removed check for compiler feature
	decimal-float-support.
	* ieee754r/frexpd32.c (INTERNAL_FUNCTION_NAME): Initialize 'result' to
	DEC_NAN because compiler can't see that it's set in a macro and
	generates warnings.
	* sysdeps/bid/Versions (libdfp): LIBDFP_1.0.0 tagged
	* sysdeps/dpd/Versions (libdfp): LIBDFP_1.0.0 tagged
	* sysdeps/dpd/dpd-private.c (__get_digits_d32, __get_digits_d64,
	__get_digits_d128): initialize exp = 0;
	* sysdeps/powerpc/dfpu/numdigits.h (numdigits): Conditionally define
	'f' based on _Decimal size to prevent the compiler from messing up the
	register order requirements.
	* sysdeps/soft-dfp/Versions (libdfp): LIBDFP_1.0.0 tagged
	* sysdeps/soft-dfp/bid/Versions (libdfp): LIBDFP_1.0.0 tagged
	* sysdeps/soft-dfp/dpd/Versions (libdfp): LIBDFP_1.0.0 tagged
	* tests/decode.h: New file providing non-exported decoded[32|64|128]
	prototypes used in tests and debugging.
	* tests/scaffold.c (_DC, _DC_P): Added macros for testing against
	decoded[32|64|128] output.
	* tests/test-param.c (main): Updated to use scaffold.c and test the
	values against the decoded[32|64|128] values that're expected.

2009-12-11  Andreas Krebbel  <Andreas.Krebbel@xxxxxxxxxx>

	* ieee754r/powd32.c (INTERNAL_FUNCTION_NAME): Set __isnan ->
	FUNC_D(__isnan).  Not strictly necessary since __isnan is a
	polymorphic classification function, but this was we avoid the extra
	steps of detecting the type/size of the input parameter and call the
	appropriate __isnand[32|64|128] directly.

2009-12-04  Andreas Krebbel  <Andreas.Krebbel@xxxxxxxxxx>

	* ieee754r/powd32.c: Add dfp prefix to __isnan invocation.

2009-12-04  Andreas Krebbel  <Andreas.Krebbel@xxxxxxxxxx>

	* sysdeps/s390/dfpu/fenv_libdfp.h: Move file to ...
	* sysdeps/s390/fpu/fenv_libdfp.h: ... here.

2009-11-24  Andreas Krebbel  <Andreas.Krebbel@xxxxxxxxxx>

	* configure.ac: Add a march vs mcpu gcc option check.

2009-11-20  Michael Matz  <matz@xxxxxxx>

	* Makefile.in (prefix): Set based on @prefix@ to prevent missing
	--exec-prefix from setting @exec_prefix@ to the string '$(prefix)',
	i.e. not the context of $prefix.
	($(top_builddir)/$(SHARED_VERSION_LIBRARY)): Added -W,no-whole-archive
	to close -W,whole-archive to SHARED_VERSION_LIBRARY rule.  Removed
	-nodefaultlibs -nostdlib which prevented linking against libc and libm
	which libdfp relies upon.
	* tests/test-printf.c (printf_d128s): Added correct "expected"
	strings.
	* sysdeps/soft-dfp/dpd/numdigits.h (left_justify): Changed erroneous
	FUNC_D (getexp(x)) to FUNC_D (getexp) (x) to correct macro invocation.


Added:
    libdfp/trunk/sysdeps/s390/fpu/
    libdfp/trunk/sysdeps/s390/fpu/fenv_libdfp.h
    libdfp/trunk/tests/decode.h
Removed:
    libdfp/trunk/sysdeps/s390/dfpu/fenv_libdfp.h
Modified:
    libdfp/trunk/ChangeLog
    libdfp/trunk/Makefile.in
    libdfp/trunk/README
    libdfp/trunk/TODO
    libdfp/trunk/Versions
    libdfp/trunk/Versions.def
    libdfp/trunk/autom4te.cache/output.0
    libdfp/trunk/autom4te.cache/traces.0
    libdfp/trunk/config.h.in
    libdfp/trunk/configure
    libdfp/trunk/configure.ac
    libdfp/trunk/ieee754r/Versions
    libdfp/trunk/ieee754r/frexpd32.c
    libdfp/trunk/ieee754r/powd32.c
    libdfp/trunk/strtod32.c
    libdfp/trunk/sysdeps/bid/Versions
    libdfp/trunk/sysdeps/dpd/Versions
    libdfp/trunk/sysdeps/dpd/dpd-private.c
    libdfp/trunk/sysdeps/powerpc/dfpu/numdigits.h
    libdfp/trunk/sysdeps/soft-dfp/Versions
    libdfp/trunk/sysdeps/soft-dfp/bid/Versions
    libdfp/trunk/sysdeps/soft-dfp/dpd/Versions
    libdfp/trunk/sysdeps/soft-dfp/dpd/numdigits.h
    libdfp/trunk/tests/TODO
    libdfp/trunk/tests/scaffold.c
    libdfp/trunk/tests/test-param.c
    libdfp/trunk/tests/test-printf.c

Modified: libdfp/trunk/ChangeLog
==============================================================================
--- libdfp/trunk/ChangeLog (original)
+++ libdfp/trunk/ChangeLog Wed Dec  9 14:57:47 2009
@@ -1,3 +1,80 @@
+2009-12-09  Ryan S. Arnold  <rsa@xxxxxxxxxx>
+
+	* configure: Regenerated.
+	* Makefile.in (.c.o, .c.os): Added -include $(top_builddir)/config.h to
+	pick up _BACKEND_DPD or _BACKEND_BID.
+	($(top_builddir)/$(STATIC_LIBRARY)): Add $(top_builddir) to
+	dfp_backend path.
+	* README: Added WARNING about making sure to link to a glibc that's
+	the same bitness (32|64) and the same optimization as the libdfp
+	that's being configure.  Added --with-glibc-build= examples.
+	* Versions (libdfp): LIBDFP_1.0.0 tagged.
+	* Versions.def (libdfp): LIBDFP_1.0.0 tagged.
+	* ieee754r/Versions.def (libdfp): LIBDFP_1.0.0 tagged.
+	* config.h.in: Regenerated.
+	* configure.ac: (AC_INIT): Tagged version 1.0.0.
+	(_DPD_BACKEND): AC_DEFINE_UNQUOTED; Set based on backend.
+	(_BID_BACKEND): AC_DEFINE_UNQUOTED; Set based on backend.
+	(--with-cpu): Removed submachine_opt="-mcpu=$withval".
+	($machine): On s390 cc_msize=31 NOT 32.
+	(AC_SUBST): CFLAGS and ASFLAGS.
+	(AC_CACHE_CHECK): Removed check for compiler feature
+	decimal-float-support.
+	* ieee754r/frexpd32.c (INTERNAL_FUNCTION_NAME): Initialize 'result' to
+	DEC_NAN because compiler can't see that it's set in a macro and
+	generates warnings.
+	* sysdeps/bid/Versions (libdfp): LIBDFP_1.0.0 tagged
+	* sysdeps/dpd/Versions (libdfp): LIBDFP_1.0.0 tagged
+	* sysdeps/dpd/dpd-private.c (__get_digits_d32, __get_digits_d64,
+	__get_digits_d128): initialize exp = 0;
+	* sysdeps/powerpc/dfpu/numdigits.h (numdigits): Conditionally define
+	'f' based on _Decimal size to prevent the compiler from messing up the
+	register order requirements.
+	* sysdeps/soft-dfp/Versions (libdfp): LIBDFP_1.0.0 tagged
+	* sysdeps/soft-dfp/bid/Versions (libdfp): LIBDFP_1.0.0 tagged
+	* sysdeps/soft-dfp/dpd/Versions (libdfp): LIBDFP_1.0.0 tagged
+	* tests/decode.h: New file providing non-exported decoded[32|64|128]
+	prototypes used in tests and debugging.
+	* tests/scaffold.c (_DC, _DC_P): Added macros for testing against
+	decoded[32|64|128] output.
+	* tests/test-param.c (main): Updated to use scaffold.c and test the
+	values against the decoded[32|64|128] values that're expected.
+
+2009-12-11  Andreas Krebbel  <Andreas.Krebbel@xxxxxxxxxx>
+
+	* ieee754r/powd32.c (INTERNAL_FUNCTION_NAME): Set __isnan ->
+	FUNC_D(__isnan).  Not strictly necessary since __isnan is a
+	polymorphic classification function, but this was we avoid the extra
+	steps of detecting the type/size of the input parameter and call the
+	appropriate __isnand[32|64|128] directly.
+
+2009-12-04  Andreas Krebbel  <Andreas.Krebbel@xxxxxxxxxx>
+
+	* ieee754r/powd32.c: Add dfp prefix to __isnan invocation.
+
+2009-12-04  Andreas Krebbel  <Andreas.Krebbel@xxxxxxxxxx>
+
+	* sysdeps/s390/dfpu/fenv_libdfp.h: Move file to ...
+	* sysdeps/s390/fpu/fenv_libdfp.h: ... here.
+
+2009-11-24  Andreas Krebbel  <Andreas.Krebbel@xxxxxxxxxx>
+
+	* configure.ac: Add a march vs mcpu gcc option check.
+
+2009-11-20  Michael Matz  <matz@xxxxxxx>
+
+	* Makefile.in (prefix): Set based on @prefix@ to prevent missing
+	--exec-prefix from setting @exec_prefix@ to the string '$(prefix)',
+	i.e. not the context of $prefix.
+	($(top_builddir)/$(SHARED_VERSION_LIBRARY)): Added -W,no-whole-archive
+	to close -W,whole-archive to SHARED_VERSION_LIBRARY rule.  Removed
+	-nodefaultlibs -nostdlib which prevented linking against libc and libm
+	which libdfp relies upon.
+	* tests/test-printf.c (printf_d128s): Added correct "expected"
+	strings.
+	* sysdeps/soft-dfp/dpd/numdigits.h (left_justify): Changed erroneous
+	FUNC_D (getexp(x)) to FUNC_D (getexp) (x) to correct macro invocation.
+
 2009-09-08  Andreas Krebbel  <Andreas.Krebbel@xxxxxxxxxx>
 
 	* README: Updated the S/390 availability section.

Modified: libdfp/trunk/Makefile.in
==============================================================================
--- libdfp/trunk/Makefile.in (original)
+++ libdfp/trunk/Makefile.in Wed Dec  9 14:57:47 2009
@@ -5,6 +5,7 @@
 top_srcdir := @top_srcdir@
 top_builddir = .
 
+prefix = @prefix@
 libdir := @exec_prefix@/lib
 includedir := @prefix@/include
 
@@ -13,10 +14,11 @@
 
 STATIC_LIBRARY = @PACKAGE_NAME@.a
 
-# e.g. libdfp-0.0.9.so
+# e.g. libdfp-1.0.0.so
 SHARED_VERSION_LIBRARY = @PACKAGE_NAME@-@PACKAGE_VERSION@.so
 
-# e.g. libdfp.so.1
+# e.g. libdfp.so.1.  Since this library intends to use symbol versioning there
+# probably isn't ever a reason to move to .so.2 or later.
 SHARED_LIBRARY = @PACKAGE_NAME@.so.1
 
 CC = @CC@
@@ -64,7 +66,7 @@
 +cflags	+= $(cflags-cpu)
 
 # Don't duplicate options if we inherited variables from the parent.
-+cflags>:= $(sort $(+cflags))
++cflags	:= $(sort $(+cflags))
 
 #override CFLAGS = -std=gnu99 $(gnu-inline-CFLAGS) $(+cflags)
 override CFLAGS = $(gnu-inline-CFLAGS) $(+cflags)
@@ -167,15 +169,13 @@
 
 shared: $(top_builddir)/$(SHARED_VERSION_LIBRARY)
 
-#WARNS := -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute -Wcast-qual -pedantic -Wno-long-long
-
 WARNS := -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute -Wno-long-long
 C_DEFINES := -D__STDC_DEC_FP__=200704L -D__STDC_WANT_DEC_FP__=1 -DOPTION_EGLIBC_LOCALE_CODE=1 -D_POSIX_C_SOURCE=200809L -std=gnu99 -D_SVID_SOURCE
 ASM_DEFINES := -D__ELF__ -D__ASSEMBLER__ -DASSEMBLER -D__STDC_DEC_FP__=200704L -D__STDC_WANT_DEC_FP__=1 -DOPTION_EGLIBC_LOCALE_CODE=1
 
 # Build the static object files.
 .c.o:
-	$(CC) $(CFLAGS) -c $< $(C_DEFINES) $(WARNS) -include $(top_srcdir)/include/libdfp-symbols.h $(foreach dir, $(header_search_dirs), -I$(dir)) $(glibc_headers_dir) -o $@
+	$(CC) $(CFLAGS) -c $< $(C_DEFINES) $(WARNS) -include $(top_srcdir)/include/libdfp-symbols.h -include $(top_builddir)/config.h $(foreach dir, $(header_search_dirs), -I$(dir)) $(glibc_headers_dir) -o $@
 	@echo
 .S.o:
 	$(CC) $(ASFLAGS) -c $< $(ASM_DEFINES) $(WARNS) -include $(top_srcdir)/include/libdfp-symbols.h -include $(top_builddir)/config.h $(foreach dir, $(header_search_dirs), -I$(dir)) $(glibc_headers_dir) -o $@
@@ -183,17 +183,18 @@
 
 # Build the shared object files.
 .c.os:
-	$(CC) $(CFLAGS) -c $< $(C_DEFINES) $(WARNS) -include $(top_srcdir)/include/libdfp-symbols.h $(foreach dir, $(header_search_dirs), -I$(dir)) $(glibc_headers_dir) -o $@
+	$(CC) $(CFLAGS) -c $< $(C_DEFINES) $(WARNS) -include $(top_srcdir)/include/libdfp-symbols.h -include $(top_builddir)/config.h $(foreach dir, $(header_search_dirs), -I$(dir)) $(glibc_headers_dir) -o $@
 	@echo
 .S.os:
 	$(CC) $(ASFLAGS) -c $< $(ASM_DEFINES) $(WARNS) -include $(top_srcdir)/include/libdfp-symbols.h -include $(top_builddir)/config.h $(foreach dir, $(header_search_dirs), -I$(dir)) $(glibc_headers_dir) -o $@
 	@echo
 
-
-# Archive the static library.
+# Archive the static library and include all of the .o files from the backend
+# archive.  IF the backend has more than the base directory the .o detection
+# mechanism will need to be more robust than this.
 $(top_builddir)/$(STATIC_LIBRARY): $(top_builddir)/$(dfp_backend)/$(dfp_backend_lib) $(addsuffix .o,$(libdfp_files))
 	@echo +Creating static library $@
-	$(AR) rc $@ $(wordlist 2,$(words $?),$?) $(dfp_backend)/*.o
+	$(AR) rc $@ $(wordlist 2,$(words $?),$?) $(top_builddir)/$(dfp_backend)/*.o
 	@ranlibpath=`which $(RANLIB)`; \
 	if test -x "$$ranlibpath"; \
 	then $(RANLIB) $@; fi;
@@ -204,7 +205,7 @@
 # -bsymbolic makes the library avoid using the PLT for library internal calls.
 $(top_builddir)/$(SHARED_VERSION_LIBRARY): $(top_builddir)/$(dfp_name).map $(addsuffix .os,$(libdfp_files))
 	@echo +Linking shared object files into $@ and creating version symlink $(SHARED_LIBRARY).
-	$(CC) -shared -Wl,-soname,$(SHARED_LIBRARY) -Bsymbolic -nodefaultlibs -nostdlib -Wl,--whole-archive $(dfp_backend)/$(dfp_backend_lib) -Wl,--version-script,$(dfp_name).map $(wordlist 2,$(words $?),$?) -o $@; \
+	$(CC) -shared -Wl,-soname,$(SHARED_LIBRARY) -Bsymbolic -Wl,--whole-archive $(dfp_backend)/$(dfp_backend_lib) -Wl,--no-whole-archive -Wl,--version-script,$(dfp_name).map $(wordlist 2,$(words $?),$?) -o $@ -lm; \
 	ln -s $(top_builddir)/$@ $(SHARED_LIBRARY)
 	@echo
 
@@ -262,10 +263,6 @@
 	@echo
 
 LIBRARY_PATH = $(glibc_builddir)/:$(glibc_builddir)/math:$(glibc_builddir)/elf:$(glibc_builddir)/nptl
-#$(glibc_builddir)/dlfcn:\
-#	$(glibc_builddir)/nss:$(glibc_builddir)/nis:\
-#	$(glibc_builddir)/rt:$(glibc_builddir)/resolv:\
-#	$(glibc_builddir)/crypt:
 
 # Invoke the GLIBC loader and tell it to run the application.  Also make sure
 # the .gdb files are generated before the tests are run so that they get
@@ -280,7 +277,7 @@
 
 DISTCLEANFILES = $(top_builddir)/debug-test.conf
 
-# Pick up the following rules from Makefile.debug:
+# The following rules are defined in Makefile.gdb:
 #	$(top_builddir)/debug-test.conf:
 #	$(addsuffix .conf,$(libdfp_tests)):
 #	$(addsuffix .gdb,$(libdfp_tests)):
@@ -289,12 +286,10 @@
 # We use debug-test.conf as an input file for some debugging utilities.
 check: $(top_builddir)/debug-test.conf $(addsuffix .conf,$(libdfp_tests)) $(addsuffix .out,$(libdfp_tests)) $(addsuffix .gdb,$(libdfp_tests))
 
-#	@echo Running make check against tests: $(libdfp_tests)
-
 .PHONY: check
 
 clean:
-	rm *.o *.os $(STATIC_LIBRARY) $(SHARED_LIBRARY) $(SHARED_VERSION_LIBRARY) Versions.all Versions.sysdeps libdfp.map Versions.tmp sysd-versions $(top_builddir)/$(dfp_backend)/*.o $(top_builddir)/$(dfp_backend)/*.a _make* debug-test.conf $(addsuffix .out,$(libdfp_tests)) $(addsuffix .conf,$(libdfp_tests)) $(addsuffix .gdb,$(libdfp_tests)) $(libdfp_tests) _check
+	rm *.o *.os $(STATIC_LIBRARY) $(SHARED_LIBRARY) $(SHARED_VERSION_LIBRARY) Versions.all Versions.sysdeps libdfp.map Versions.tmp sysd-versions $(top_builddir)/$(dfp_backend)/*.o $(top_builddir)/$(dfp_backend)/*.a debug-test.conf $(addsuffix .out,$(libdfp_tests)) $(addsuffix .conf,$(libdfp_tests)) $(addsuffix .gdb,$(libdfp_tests)) $(libdfp_tests)
 
 .PHONY: clean
 

Modified: libdfp/trunk/README
==============================================================================
--- libdfp/trunk/README (original)
+++ libdfp/trunk/README Wed Dec  9 14:57:47 2009
@@ -313,8 +313,14 @@
 
 	If you want to run make check but your system GLIBC isn't version 2.10
 	you need to pass the location of a temporary GLIBC build-dir (not
-	install dir).  Not passing this switch tells the make check system to
-	simply use the system GLIBC.
+	install dir) where that GLIBC meets or exceeds version 2.10.  Not
+	passing this switch tells the make check system to simply use the
+	system GLIBC.
+
+	WARNING: Make sure you link to a GLIBC build that supports the same
+	configure options as how you're configuring libdfp, e.g. if you're
+	configuring for 'power6' 64-bit, make sure that the GLIBC build you
+	link against is a 64-bit, power6 tuned build.
 
 --with-cpu={power5|power6|<etc>}
 
@@ -330,38 +336,42 @@
 General PowerPC (soft-dfp) using the libdecnumber backend and dpd encoding:
 
 CC=/opt/at05/bin/gcc \
-/home/ryanarn/ppc64-tc-utils/trunk/libdfp/src/configure \
+/home/ryanarn/eglibc/eglibc/libdfp/trunk/configure \
 	--with-backend=libdecnumber --enable-decimal-float=dpd \
 	--with-glibc-headers=/home/ryanarn/ppc64-tc-utils/trunk/libdfp/include-2.10/ \
-	 2>&1 | tee _configure64_power5
+	--with-glibc-build=/home/ryanarn/glibc-2.11/build/glibc64_power5 \
+	2>&1 | tee _configure64_power5
 
 PowerPC POWER6 (hard-dfp) using libdecnumber backend and dpd encoding:
 We only need the --with-cpu=power6 flag for power6 support and
 hardware-dfp:
 
 CC=/opt/at05/bin/gcc \
-/home/ryanarn/ppc64-tc-utils/trunk/libdfp/src/configure \
+/home/ryanarn/eglibc/eglibc/libdfp/trunk/configure \
 	--with-backend=libdecnumber --enable-decimal-float=dpd \
 	--with-glibc-headers=/home/ryanarn/ppc64-tc-utils/trunk/libdfp/include-2.10/ \
+	--with-glibc-build=/home/ryanarn/glibc-2.11/build/glibc64_power6 \
 	--with-cpu=power6 2>&1 | tee _configure64_power6
 
 To build 32-bit use the following:
 
 CC=/opt/at05/bin/gcc \
-/home/ryanarn/ppc64-tc-utils/trunk/libdfp/src/configure \
-        --with-backend=libdecnumber --enable-decimal-float=dpd \
-        --with-glibc-headers=/home/ryanarn/ppc64-tc-utils/trunk/libdfp/include-2.10/ \
+/home/ryanarn/eglibc/eglibc/libdfp/trunk/configure \
+	--with-backend=libdecnumber --enable-decimal-float=dpd \
+	--with-glibc-headers=/home/ryanarn/ppc64-tc-utils/trunk/libdfp/include-2.10/ \
 	--build=powerpc-linux-gnu --host=powerpc-linux-gnu \
-         2>&1 | tee _configure64_power5
+	--with-glibc-build=/home/ryanarn/glibc-2.11/build/glibc32_power5 \
+	2>&1 | tee _configure32_power5
 
 Or 32-bit POWER6:
 
 CC=/opt/at05/bin/gcc \
-/home/ryanarn/ppc64-tc-utils/trunk/libdfp/src/configure \
-        --with-backend=libdecnumber --enable-decimal-float=dpd \
-        --with-glibc-headers=/home/ryanarn/ppc64-tc-utils/trunk/libdfp/include-2.10/ \
+/home/ryanarn/eglibc/eglibc/libdfp/trunk/configure \
+	--with-backend=libdecnumber --enable-decimal-float=dpd \
+	--with-glibc-headers=/home/ryanarn/ppc64-tc-utils/trunk/libdfp/include-2.10/ \
 	--build=powerpc-linux-gnu --host=powerpc-linux-gnu \
-         2>&1 | tee _configure64_power5
+	--with-glibc-build=/home/ryanarn/glibc-2.11/build/glibc32_power6 \
+	--with-cpu=power6 2>&1 | tee _configure32_power6
 
 ---------------------------------------------------------------------------
 6. Source Tree Layout

Modified: libdfp/trunk/TODO
==============================================================================
--- libdfp/trunk/TODO (original)
+++ libdfp/trunk/TODO Wed Dec  9 14:57:47 2009
@@ -20,3 +20,5 @@
 Optimize the math routines for hardware dfp support.
 
 Implement libbid backend.
+
+configure runtime test for decimal floating point support in compiler.

Modified: libdfp/trunk/Versions
==============================================================================
--- libdfp/trunk/Versions (original)
+++ libdfp/trunk/Versions Wed Dec  9 14:57:47 2009
@@ -1,5 +1,5 @@
 libdfp {
-  LIBDFP_0.9 {
+  LIBDFP_1.0.0 {
     decoded32;
     decoded64;
     decoded128;

Modified: libdfp/trunk/Versions.def
==============================================================================
--- libdfp/trunk/Versions.def (original)
+++ libdfp/trunk/Versions.def Wed Dec  9 14:57:47 2009
@@ -1,4 +1,4 @@
 libdfp {
-  LIBDFP_0.9
+  LIBDFP_1.0.0
   LIBDFP_PRIVATE
 }

Modified: libdfp/trunk/autom4te.cache/output.0
==============================================================================
--- libdfp/trunk/autom4te.cache/output.0 (original)
+++ libdfp/trunk/autom4te.cache/output.0 Wed Dec  9 14:57:47 2009
@@ -1,6 +1,6 @@
 @%:@! /bin/sh
 @%:@ Guess values for system-dependent variables and create Makefiles.
-@%:@ Generated by GNU Autoconf 2.59 for libdfp 0.0.1.
+@%:@ Generated by GNU Autoconf 2.59 for libdfp 1.0.0.
 @%:@
 @%:@ Report bugs to <rsa@xxxxxxxxxx>.
 @%:@ 
@@ -269,14 +269,14 @@
 # Identity of this package.
 PACKAGE_NAME='libdfp'
 PACKAGE_TARNAME='libdfp'
-PACKAGE_VERSION='0.0.1'
-PACKAGE_STRING='libdfp 0.0.1'
+PACKAGE_VERSION='1.0.0'
+PACKAGE_STRING='libdfp 1.0.0'
 PACKAGE_BUGREPORT='rsa@xxxxxxxxxx'
 
 ac_unique_file="printf_dfp.c"
 ac_subdirs_all="$ac_subdirs_all libdecnumber"
 ac_subdirs_all="$ac_subdirs_all libbid"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os enable_decimal_float dfp_backend with_dfp with_fp base_machine machine CC cc_msize libdfp_cv_cc_with_decimal_float glibc_headers glibc_build enable_static enable_shared submachine submachine_opt sysdep_dirs RANLIB ac_ct_RANLIB AWK subdirs LIB@&t@OBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os enable_decimal_float dfp_backend with_dfp with_fp base_machine machine CC cc_msize CFLAGS ASFLAGS glibc_headers glibc_build enable_static enable_shared submachine submachine_opt sysdep_dirs RANLIB ac_ct_RANLIB AWK subdirs LIB@&t@OBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -725,7 +725,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures libdfp 0.0.1 to adapt to many kinds of systems.
+\`configure' configures libdfp 1.0.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -786,7 +786,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of libdfp 0.0.1:";;
+     short | recursive ) echo "Configuration of libdfp 1.0.0:";;
    esac
   cat <<\_ACEOF
 
@@ -920,7 +920,7 @@
 test -n "$ac_init_help" && exit 0
 if $ac_init_version; then
   cat <<\_ACEOF
-libdfp configure 0.0.1
+libdfp configure 1.0.0
 generated by GNU Autoconf 2.59
 
 Copyright (C) 2003 Free Software Foundation, Inc.
@@ -934,7 +934,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by libdfp $as_me 0.0.1, which was
+It was created by libdfp $as_me 1.0.0, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   $ $0 $@
@@ -1429,9 +1429,28 @@
   enable_decimal_float="$default_encoding"
 fi; 
 
-
 { echo "$as_me:$LINENO: Using $enable_decimal_float decimal floating point encoding" >&5
 echo "$as_me: Using $enable_decimal_float decimal floating point encoding" >&6;}
+
+# Some code may need to have conditional guards based on the backend.  Give the
+# developers _DPD_BACKEND or _BID_BACKEND.  Try avoiding this as much as
+# possible and use sysdep file overrides.  A good place to use it is in the
+# tests/ directory.
+if test $enable_decimal_float = dpd; then
+  
+cat >>confdefs.h <<_ACEOF
+@%:@define _DPD_BACKEND 1
+		     
+_ACEOF
+
+else
+  
+cat >>confdefs.h <<_ACEOF
+@%:@define _BID_BACKEND 1
+		     
+_ACEOF
+
+fi
 
 # Now we know how to chose the desired backend directory, e.g.
 # src/backend/libdecnumber or src/backend/libbid when we build our search
@@ -1495,31 +1514,26 @@
     ;;
   power6)
     submachine="$withval"
-    submachine_opt="-mcpu=$withval"
     { echo "$as_me:$LINENO: configuring for the $submachine processor" >&5
 echo "$as_me: configuring for the $submachine processor" >&6;}
     with_dfp=yes ;;
   power6x)
     submachine="$withval"
-    submachine_opt="-mcpu=$withval"
     { echo "$as_me:$LINENO: configuring for the $submachine processor" >&5
 echo "$as_me: configuring for the $submachine processor" >&6;}
     with_dfp=yes ;;
   z9-ec)
     submachine="$withval"
-    submachine_opt="-march=$withval"
     { echo "$as_me:$LINENO: configuring for the $submachine processor" >&5
 echo "$as_me: configuring for the $submachine processor" >&6;}
     with_dfp=yes ;;
   z10)
     submachine="$withval"
-    submachine_opt="-march=$withval"
     { echo "$as_me:$LINENO: configuring for the $submachine processor" >&5
 echo "$as_me: configuring for the $submachine processor" >&6;}
     with_dfp=yes ;;
   *)
     submachine="$withval"
-    submachine_opt="-mcpu=$withval"
     { echo "$as_me:$LINENO: configuring for the $submachine processor" >&5
 echo "$as_me: configuring for the $submachine processor" >&6;}
     with_dfp=no ;;
@@ -1528,6 +1542,34 @@
 else
   with_dfp=no
 fi; 
+
+if test -n "$submachine"; then
+  echo "$as_me:$LINENO: checking for compiler option for CPU variant" >&5
+echo $ECHO_N "checking for compiler option for CPU variant... $ECHO_C" >&6
+if test "${submachine_opt+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+    submachine_opt=no
+  for opt in "-march=$submachine" "-mcpu=$submachine"; do
+    if { ac_try='${CC-cc} $opt -xc /dev/null -S -o /dev/null'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+      submachine_opt="$opt"
+      break
+    fi
+  done
+fi
+echo "$as_me:$LINENO: result: $submachine_opt" >&5
+echo "${ECHO_T}$submachine_opt" >&6
+  if test "x$submachine_opt" = xno; then
+    { { echo "$as_me:$LINENO: error: ${CC-cc} does not support $submachine" >&5
+echo "$as_me: error: ${CC-cc} does not support $submachine" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+fi
 
 # This tells us whether we know we have a hardware decimal floating point
 # unit.  We know this based upon the submachine.
@@ -1550,7 +1592,7 @@
 case "$machine" in
 	powerpc) base_machine=powerpc machine=powerpc/powerpc32 cc_msize=32 ;;
 	powerpc64) base_machine=powerpc machine=powerpc/powerpc64 cc_msize=64;;
-	s390) base_machine=s390 machine=s390/s390-32 cc_msize=32;;
+	s390) base_machine=s390 machine=s390/s390-32 cc_msize=31;;
 	s390x) base_machine=s390 machine=s390/s390-64 cc_msize=64;;
 	i[34567]86) base_machine=i386 machine=i386/$machine ;;
 	*) base_machine=$machine ;;
@@ -1566,41 +1608,34 @@
 
 
 
+
+
+
+# TODO replace this with a compiler type check.
 # Don't even bother configuring if the compiler doesn't support Decimal
 # Floating Point.
-echo "$as_me:$LINENO: checking for decimal-float-support in compiler" >&5
-echo $ECHO_N "checking for decimal-float-support in compiler... $ECHO_C" >&6
-if test "${libdfp_cv_cc_with_decimal_float+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  
-		cat > conftest.c <<EOF
-int main (void) { _Decimal64 d64; d64 = 1.0DD; return 0; }
-EOF
-  if ${CC} ${CFLAGS} ${CPPFLAGS} $LDFLAGS -static -o conftest \
-       conftest.c -v 2>&1 >/dev/null | grep -q " --enable-decimal-float ";
-  then
-    libdfp_cv_cc_with_decimal_float=yes
-  else
-    libdfp_cv_cc_with_decimal_float=no
-    { echo "$as_me:$LINENO: WARNING: CC is ${CC}" >&5
-echo "$as_me: WARNING: CC is ${CC}" >&2;}
-    { { echo "$as_me:$LINENO: error: ${PACKAGE_NAME} requires a compiler configured and built
-		  with --enable-decimal-float." >&5
-echo "$as_me: error: ${PACKAGE_NAME} requires a compiler configured and built
-		  with --enable-decimal-float." >&2;}
-   { (exit 1); exit 1; }; }
-  fi
-  rm -f conftest*
-fi
-echo "$as_me:$LINENO: result: $libdfp_cv_cc_with_decimal_float" >&5
-echo "${ECHO_T}$libdfp_cv_cc_with_decimal_float" >&6
-
-if test $libdfp_cv_cc_with_decimal_float = yes; then
-  cat >> confdefs.h <<\EOF
-#define __STDC_DEC_FP__ 200704L
-EOF
-fi
+#AC_CACHE_CHECK(for decimal-float-support in compiler,
+#	       libdfp_cv_cc_with_decimal_float, [
+#		cat > conftest.c <<EOF
+#int main (void) { _Decimal64 d64; d64 = 1.0DD; return 0; }
+#EOF
+#  if ${CC} ${CFLAGS} ${CPPFLAGS} $LDFLAGS -static -o conftest \
+#       conftest.c -v 2>&1 >/dev/null | grep -q " --enable-decimal-float ";
+#  then
+#    libdfp_cv_cc_with_decimal_float=yes
+#  else
+#    libdfp_cv_cc_with_decimal_float=no
+#    AC_MSG_WARN([CC is ${CC}])
+#    AC_MSG_ERROR([${PACKAGE_NAME} requires a compiler configured and built
+#		  with --enable-decimal-float.])
+#  fi
+#  rm -f conftest*])
+#AC_SUBST(libdfp_cv_cc_with_decimal_float)
+#if test $libdfp_cv_cc_with_decimal_float = yes; then
+#  cat >> confdefs.h <<\EOF
+##define __STDC_DEC_FP__ 200704L
+#EOF
+#fi
 
 glibc_headers=
 
@@ -2423,7 +2458,7 @@
 } >&5
 cat >&5 <<_CSEOF
 
-This file was extended by libdfp $as_me 0.0.1, which was
+This file was extended by libdfp $as_me 1.0.0, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -2483,7 +2518,7 @@
 
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-libdfp config.status 0.0.1
+libdfp config.status 1.0.0
 configured by $0, generated by GNU Autoconf 2.59,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 
@@ -2687,7 +2722,8 @@
 s,@machine@,$machine,;t t
 s,@CC@,$CC,;t t
 s,@cc_msize@,$cc_msize,;t t
-s,@libdfp_cv_cc_with_decimal_float@,$libdfp_cv_cc_with_decimal_float,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@ASFLAGS@,$ASFLAGS,;t t
 s,@glibc_headers@,$glibc_headers,;t t
 s,@glibc_build@,$glibc_build,;t t
 s,@enable_static@,$enable_static,;t t

Modified: libdfp/trunk/autom4te.cache/traces.0
==============================================================================
--- libdfp/trunk/autom4te.cache/traces.0 (original)
+++ libdfp/trunk/autom4te.cache/traces.0 Wed Dec  9 14:57:47 2009
@@ -1,4 +1,4 @@
-m4trace:configure.ac:8: -1- AC_INIT([libdfp], [0.0.1], [rsa@xxxxxxxxxx])
+m4trace:configure.ac:8: -1- AC_INIT([libdfp], [1.0.0], [rsa@xxxxxxxxxx])
 m4trace:configure.ac:8: -1- m4_pattern_forbid([^_?A[CHUM]_])
 m4trace:configure.ac:8: -1- m4_pattern_forbid([_AC_])
 m4trace:configure.ac:8: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS'])
@@ -63,38 +63,45 @@
 m4trace:configure.ac:26: -1- AC_SUBST([host_vendor], [`echo $ac_cv_host | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\2/'`])
 m4trace:configure.ac:26: -1- AC_SUBST([host_os], [`echo $ac_cv_host | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\3/'`])
 m4trace:configure.ac:84: -1- AC_SUBST([enable_decimal_float])
-m4trace:configure.ac:139: -1- AC_SUBST([dfp_backend])
-m4trace:configure.ac:183: -1- AC_SUBST([with_dfp])
-m4trace:configure.ac:190: -1- AC_SUBST([with_fp])
-m4trace:configure.ac:207: -1- AC_SUBST([base_machine])
-m4trace:configure.ac:208: -1- AC_SUBST([machine])
-m4trace:configure.ac:217: -1- AC_SUBST([CC])
-m4trace:configure.ac:218: -1- AC_SUBST([cc_msize])
-m4trace:configure.ac:238: -1- AC_SUBST([libdfp_cv_cc_with_decimal_float])
-m4trace:configure.ac:255: -1- AC_SUBST([glibc_headers])
-m4trace:configure.ac:266: -1- AC_SUBST([glibc_build])
-m4trace:configure.ac:283: -1- AC_SUBST([enable_static])
-m4trace:configure.ac:300: -1- AC_SUBST([enable_shared])
-m4trace:configure.ac:392: -1- AC_SUBST([submachine])
-m4trace:configure.ac:393: -1- AC_SUBST([submachine_opt])
-m4trace:configure.ac:459: -1- AC_SUBST([sysdep_dirs])
-m4trace:configure.ac:481: -1- AC_DEFINE_TRACE_LITERAL([ASM_GLOBAL_DIRECTIVE])
-m4trace:configure.ac:481: -1- AH_OUTPUT([ASM_GLOBAL_DIRECTIVE], [/* "Define to the name of the assembler\'s directive for declaring a symbol
+m4trace:configure.ac:92: -1- AC_DEFINE_TRACE_LITERAL([_DPD_BACKEND])
+m4trace:configure.ac:92: -1- AH_OUTPUT([_DPD_BACKEND], [/* "Defined if DPD is the backend designated by configure." */
+#undef _DPD_BACKEND])
+m4trace:configure.ac:95: -1- AC_DEFINE_TRACE_LITERAL([_BID_BACKEND])
+m4trace:configure.ac:95: -1- AH_OUTPUT([_BID_BACKEND], [/* "Defined if BID is the backend designated by configure." */
+#undef _BID_BACKEND])
+m4trace:configure.ac:150: -1- AC_SUBST([dfp_backend])
+m4trace:configure.ac:204: -1- AC_SUBST([with_dfp])
+m4trace:configure.ac:211: -1- AC_SUBST([with_fp])
+m4trace:configure.ac:228: -1- AC_SUBST([base_machine])
+m4trace:configure.ac:229: -1- AC_SUBST([machine])
+m4trace:configure.ac:238: -1- AC_SUBST([CC])
+m4trace:configure.ac:239: -1- AC_SUBST([cc_msize])
+m4trace:configure.ac:241: -1- AC_SUBST([CFLAGS])
+m4trace:configure.ac:242: -1- AC_SUBST([ASFLAGS])
+m4trace:configure.ac:280: -1- AC_SUBST([glibc_headers])
+m4trace:configure.ac:291: -1- AC_SUBST([glibc_build])
+m4trace:configure.ac:308: -1- AC_SUBST([enable_static])
+m4trace:configure.ac:325: -1- AC_SUBST([enable_shared])
+m4trace:configure.ac:417: -1- AC_SUBST([submachine])
+m4trace:configure.ac:418: -1- AC_SUBST([submachine_opt])
+m4trace:configure.ac:484: -1- AC_SUBST([sysdep_dirs])
+m4trace:configure.ac:506: -1- AC_DEFINE_TRACE_LITERAL([ASM_GLOBAL_DIRECTIVE])
+m4trace:configure.ac:506: -1- AH_OUTPUT([ASM_GLOBAL_DIRECTIVE], [/* "Define to the name of the assembler\'s directive for declaring a symbol
    global (default `.globl\')." */
 #undef ASM_GLOBAL_DIRECTIVE])
-m4trace:configure.ac:504: -1- AC_DEFINE_TRACE_LITERAL([ASM_TYPE_DIRECTIVE_PREFIX])
-m4trace:configure.ac:504: -1- AH_OUTPUT([ASM_TYPE_DIRECTIVE_PREFIX], [/* "Define to the prefix before `object\' or `function\' in the assembler\'s
+m4trace:configure.ac:529: -1- AC_DEFINE_TRACE_LITERAL([ASM_TYPE_DIRECTIVE_PREFIX])
+m4trace:configure.ac:529: -1- AH_OUTPUT([ASM_TYPE_DIRECTIVE_PREFIX], [/* "Define to the prefix before `object\' or `function\' in the assembler\'s
    `.type\' directive */
 #undef ASM_TYPE_DIRECTIVE_PREFIX])
-m4trace:configure.ac:511: -1- AC_PROG_RANLIB
-m4trace:configure.ac:511: -1- AC_SUBST([RANLIB])
-m4trace:configure.ac:511: -1- AC_SUBST([ac_ct_RANLIB])
-m4trace:configure.ac:512: -1- AC_PROG_AWK
-m4trace:configure.ac:512: -1- AC_SUBST([AWK])
-m4trace:configure.ac:528: -1- AC_CONFIG_SUBDIRS([libdecnumber])
-m4trace:configure.ac:528: -1- AC_SUBST([subdirs], ["$subdirs libdecnumber"])
-m4trace:configure.ac:530: -1- AC_CONFIG_SUBDIRS([libbid])
-m4trace:configure.ac:530: -1- AC_SUBST([subdirs], ["$subdirs libbid"])
-m4trace:configure.ac:536: -1- AC_CONFIG_FILES([Makefile])
-m4trace:configure.ac:538: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs])
-m4trace:configure.ac:538: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs])
+m4trace:configure.ac:536: -1- AC_PROG_RANLIB
+m4trace:configure.ac:536: -1- AC_SUBST([RANLIB])
+m4trace:configure.ac:536: -1- AC_SUBST([ac_ct_RANLIB])
+m4trace:configure.ac:537: -1- AC_PROG_AWK
+m4trace:configure.ac:537: -1- AC_SUBST([AWK])
+m4trace:configure.ac:553: -1- AC_CONFIG_SUBDIRS([libdecnumber])
+m4trace:configure.ac:553: -1- AC_SUBST([subdirs], ["$subdirs libdecnumber"])
+m4trace:configure.ac:555: -1- AC_CONFIG_SUBDIRS([libbid])
+m4trace:configure.ac:555: -1- AC_SUBST([subdirs], ["$subdirs libbid"])
+m4trace:configure.ac:561: -1- AC_CONFIG_FILES([Makefile])
+m4trace:configure.ac:563: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs])
+m4trace:configure.ac:563: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs])

Modified: libdfp/trunk/config.h.in
==============================================================================
--- libdfp/trunk/config.h.in (original)
+++ libdfp/trunk/config.h.in Wed Dec  9 14:57:47 2009
@@ -22,3 +22,9 @@
 
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
+
+/* "Defined if BID is the backend designated by configure." */
+#undef _BID_BACKEND
+
+/* "Defined if DPD is the backend designated by configure." */
+#undef _DPD_BACKEND

Modified: libdfp/trunk/configure
==============================================================================
--- libdfp/trunk/configure (original)
+++ libdfp/trunk/configure Wed Dec  9 14:57:47 2009
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for libdfp 0.0.1.
+# Generated by GNU Autoconf 2.59 for libdfp 1.0.0.
 #
 # Report bugs to <rsa@xxxxxxxxxx>.
 #
@@ -269,14 +269,14 @@
 # Identity of this package.
 PACKAGE_NAME='libdfp'
 PACKAGE_TARNAME='libdfp'
-PACKAGE_VERSION='0.0.1'
-PACKAGE_STRING='libdfp 0.0.1'
+PACKAGE_VERSION='1.0.0'
+PACKAGE_STRING='libdfp 1.0.0'
 PACKAGE_BUGREPORT='rsa@xxxxxxxxxx'
 
 ac_unique_file="printf_dfp.c"
 ac_subdirs_all="$ac_subdirs_all libdecnumber"
 ac_subdirs_all="$ac_subdirs_all libbid"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os enable_decimal_float dfp_backend with_dfp with_fp base_machine machine CC cc_msize libdfp_cv_cc_with_decimal_float glibc_headers glibc_build enable_static enable_shared submachine submachine_opt sysdep_dirs RANLIB ac_ct_RANLIB AWK subdirs LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os enable_decimal_float dfp_backend with_dfp with_fp base_machine machine CC cc_msize CFLAGS ASFLAGS glibc_headers glibc_build enable_static enable_shared submachine submachine_opt sysdep_dirs RANLIB ac_ct_RANLIB AWK subdirs LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -725,7 +725,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures libdfp 0.0.1 to adapt to many kinds of systems.
+\`configure' configures libdfp 1.0.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -786,7 +786,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of libdfp 0.0.1:";;
+     short | recursive ) echo "Configuration of libdfp 1.0.0:";;
    esac
   cat <<\_ACEOF
 
@@ -920,7 +920,7 @@
 test -n "$ac_init_help" && exit 0
 if $ac_init_version; then
   cat <<\_ACEOF
-libdfp configure 0.0.1
+libdfp configure 1.0.0
 generated by GNU Autoconf 2.59
 
 Copyright (C) 2003 Free Software Foundation, Inc.
@@ -934,7 +934,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by libdfp $as_me 0.0.1, which was
+It was created by libdfp $as_me 1.0.0, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   $ $0 $@
@@ -1429,9 +1429,28 @@
   enable_decimal_float="$default_encoding"
 fi;
 
-
 { echo "$as_me:$LINENO: Using $enable_decimal_float decimal floating point encoding" >&5
 echo "$as_me: Using $enable_decimal_float decimal floating point encoding" >&6;}
+
+# Some code may need to have conditional guards based on the backend.  Give the
+# developers _DPD_BACKEND or _BID_BACKEND.  Try avoiding this as much as
+# possible and use sysdep file overrides.  A good place to use it is in the
+# tests/ directory.
+if test $enable_decimal_float = dpd; then
+
+cat >>confdefs.h <<_ACEOF
+#define _DPD_BACKEND 1
+
+_ACEOF
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define _BID_BACKEND 1
+
+_ACEOF
+
+fi
 
 # Now we know how to chose the desired backend directory, e.g.
 # src/backend/libdecnumber or src/backend/libbid when we build our search
@@ -1495,31 +1514,26 @@
     ;;
   power6)
     submachine="$withval"
-    submachine_opt="-mcpu=$withval"
     { echo "$as_me:$LINENO: configuring for the $submachine processor" >&5
 echo "$as_me: configuring for the $submachine processor" >&6;}
     with_dfp=yes ;;
   power6x)
     submachine="$withval"
-    submachine_opt="-mcpu=$withval"
     { echo "$as_me:$LINENO: configuring for the $submachine processor" >&5
 echo "$as_me: configuring for the $submachine processor" >&6;}
     with_dfp=yes ;;
   z9-ec)
     submachine="$withval"
-    submachine_opt="-march=$withval"
     { echo "$as_me:$LINENO: configuring for the $submachine processor" >&5
 echo "$as_me: configuring for the $submachine processor" >&6;}
     with_dfp=yes ;;
   z10)
     submachine="$withval"
-    submachine_opt="-march=$withval"
     { echo "$as_me:$LINENO: configuring for the $submachine processor" >&5
 echo "$as_me: configuring for the $submachine processor" >&6;}
     with_dfp=yes ;;
   *)
     submachine="$withval"
-    submachine_opt="-mcpu=$withval"
     { echo "$as_me:$LINENO: configuring for the $submachine processor" >&5
 echo "$as_me: configuring for the $submachine processor" >&6;}
     with_dfp=no ;;
@@ -1528,6 +1542,34 @@
 else
   with_dfp=no
 fi;
+
+if test -n "$submachine"; then
+  echo "$as_me:$LINENO: checking for compiler option for CPU variant" >&5
+echo $ECHO_N "checking for compiler option for CPU variant... $ECHO_C" >&6
+if test "${submachine_opt+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+    submachine_opt=no
+  for opt in "-march=$submachine" "-mcpu=$submachine"; do
+    if { ac_try='${CC-cc} $opt -xc /dev/null -S -o /dev/null'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+      submachine_opt="$opt"
+      break
+    fi
+  done
+fi
+echo "$as_me:$LINENO: result: $submachine_opt" >&5
+echo "${ECHO_T}$submachine_opt" >&6
+  if test "x$submachine_opt" = xno; then
+    { { echo "$as_me:$LINENO: error: ${CC-cc} does not support $submachine" >&5
+echo "$as_me: error: ${CC-cc} does not support $submachine" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+fi
 
 # This tells us whether we know we have a hardware decimal floating point
 # unit.  We know this based upon the submachine.
@@ -1550,7 +1592,7 @@
 case "$machine" in
 	powerpc) base_machine=powerpc machine=powerpc/powerpc32 cc_msize=32 ;;
 	powerpc64) base_machine=powerpc machine=powerpc/powerpc64 cc_msize=64;;
-	s390) base_machine=s390 machine=s390/s390-32 cc_msize=32;;
+	s390) base_machine=s390 machine=s390/s390-32 cc_msize=31;;
 	s390x) base_machine=s390 machine=s390/s390-64 cc_msize=64;;
 	i[34567]86) base_machine=i386 machine=i386/$machine ;;
 	*) base_machine=$machine ;;
@@ -1566,41 +1608,34 @@
 
 
 
+
+
+
+# TODO replace this with a compiler type check.
 # Don't even bother configuring if the compiler doesn't support Decimal
 # Floating Point.
-echo "$as_me:$LINENO: checking for decimal-float-support in compiler" >&5
-echo $ECHO_N "checking for decimal-float-support in compiler... $ECHO_C" >&6
-if test "${libdfp_cv_cc_with_decimal_float+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
-		cat > conftest.c <<EOF
-int main (void) { _Decimal64 d64; d64 = 1.0DD; return 0; }
-EOF
-  if ${CC} ${CFLAGS} ${CPPFLAGS} $LDFLAGS -static -o conftest \
-       conftest.c -v 2>&1 >/dev/null | grep -q " --enable-decimal-float ";
-  then
-    libdfp_cv_cc_with_decimal_float=yes
-  else
-    libdfp_cv_cc_with_decimal_float=no
-    { echo "$as_me:$LINENO: WARNING: CC is ${CC}" >&5
-echo "$as_me: WARNING: CC is ${CC}" >&2;}
-    { { echo "$as_me:$LINENO: error: ${PACKAGE_NAME} requires a compiler configured and built
-		  with --enable-decimal-float." >&5
-echo "$as_me: error: ${PACKAGE_NAME} requires a compiler configured and built
-		  with --enable-decimal-float." >&2;}
-   { (exit 1); exit 1; }; }
-  fi
-  rm -f conftest*
-fi
-echo "$as_me:$LINENO: result: $libdfp_cv_cc_with_decimal_float" >&5
-echo "${ECHO_T}$libdfp_cv_cc_with_decimal_float" >&6
-
-if test $libdfp_cv_cc_with_decimal_float = yes; then
-  cat >> confdefs.h <<\EOF
-#define __STDC_DEC_FP__ 200704L
-EOF
-fi
+#AC_CACHE_CHECK(for decimal-float-support in compiler,
+#	       libdfp_cv_cc_with_decimal_float, [
+#		cat > conftest.c <<EOF
+#int main (void) { _Decimal64 d64; d64 = 1.0DD; return 0; }
+#EOF
+#  if ${CC} ${CFLAGS} ${CPPFLAGS} $LDFLAGS -static -o conftest \
+#       conftest.c -v 2>&1 >/dev/null | grep -q " --enable-decimal-float ";
+#  then
+#    libdfp_cv_cc_with_decimal_float=yes
+#  else
+#    libdfp_cv_cc_with_decimal_float=no
+#    AC_MSG_WARN([CC is ${CC}])
+#    AC_MSG_ERROR([${PACKAGE_NAME} requires a compiler configured and built
+#		  with --enable-decimal-float.])
+#  fi
+#  rm -f conftest*])
+#AC_SUBST(libdfp_cv_cc_with_decimal_float)
+#if test $libdfp_cv_cc_with_decimal_float = yes; then
+#  cat >> confdefs.h <<\EOF
+##define __STDC_DEC_FP__ 200704L
+#EOF
+#fi
 
 glibc_headers=
 
@@ -2423,7 +2458,7 @@
 } >&5
 cat >&5 <<_CSEOF
 
-This file was extended by libdfp $as_me 0.0.1, which was
+This file was extended by libdfp $as_me 1.0.0, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -2483,7 +2518,7 @@
 
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-libdfp config.status 0.0.1
+libdfp config.status 1.0.0
 configured by $0, generated by GNU Autoconf 2.59,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 
@@ -2687,7 +2722,8 @@
 s,@machine@,$machine,;t t
 s,@CC@,$CC,;t t
 s,@cc_msize@,$cc_msize,;t t
-s,@libdfp_cv_cc_with_decimal_float@,$libdfp_cv_cc_with_decimal_float,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@ASFLAGS@,$ASFLAGS,;t t
 s,@glibc_headers@,$glibc_headers,;t t
 s,@glibc_build@,$glibc_build,;t t
 s,@enable_static@,$enable_static,;t t

Modified: libdfp/trunk/configure.ac
==============================================================================
--- libdfp/trunk/configure.ac (original)
+++ libdfp/trunk/configure.ac Wed Dec  9 14:57:47 2009
@@ -4,8 +4,8 @@
 # Autoconf 2.59 required because recursively configured 'libdecnumber' library
 # has a hard-coded 2.59 requirement and Libdfp doesn't really care, but can't
 # control libdecnumber.
-AC_PREREQ(2.59) 
-AC_INIT(libdfp, 0.0.9, rsa@xxxxxxxxxx)
+AC_PREREQ(2.59)
+AC_INIT(libdfp, 1.0.0, rsa@xxxxxxxxxx)
 AC_CONFIG_SRCDIR([printf_dfp.c])
 
 # We don't use Automake so this is necessary.
@@ -82,8 +82,19 @@
   esac],
   [enable_decimal_float="$default_encoding"])
 AC_SUBST(enable_decimal_float)
-
 AC_MSG_NOTICE(Using $enable_decimal_float decimal floating point encoding)
+
+# Some code may need to have conditional guards based on the backend.  Give the
+# developers _DPD_BACKEND or _BID_BACKEND.  Try avoiding this as much as
+# possible and use sysdep file overrides.  A good place to use it is in the
+# tests/ directory.
+if test $enable_decimal_float = dpd; then
+  AC_DEFINE_UNQUOTED(_DPD_BACKEND,1
+		     ,"Defined if DPD is the backend designated by configure.")
+else
+  AC_DEFINE_UNQUOTED(_BID_BACKEND,1
+		     ,"Defined if BID is the backend designated by configure.")
+fi
 
 # Now we know how to chose the desired backend directory, e.g.
 # src/backend/libdecnumber or src/backend/libbid when we build our search
@@ -152,31 +163,41 @@
     ;;
   power6)
     submachine="$withval"
-    submachine_opt="-mcpu=$withval"
     AC_MSG_NOTICE(configuring for the $submachine processor)
     with_dfp=yes ;;
   power6x)
     submachine="$withval"
-    submachine_opt="-mcpu=$withval"
     AC_MSG_NOTICE(configuring for the $submachine processor)
     with_dfp=yes ;;
   z9-ec)
     submachine="$withval"
-    submachine_opt="-march=$withval"
     AC_MSG_NOTICE(configuring for the $submachine processor)
     with_dfp=yes ;;
   z10)
     submachine="$withval"
-    submachine_opt="-march=$withval"
     AC_MSG_NOTICE(configuring for the $submachine processor)
     with_dfp=yes ;;
   *)
     submachine="$withval"
-    submachine_opt="-mcpu=$withval"
     AC_MSG_NOTICE(configuring for the $submachine processor)
     with_dfp=no ;;
   esac
 ],[with_dfp=no])
+
+if test -n "$submachine"; then
+  AC_CACHE_CHECK([for compiler option for CPU variant],
+                submachine_opt, [dnl
+  submachine_opt=no
+  for opt in "-march=$submachine" "-mcpu=$submachine"; do
+    if AC_TRY_COMMAND([${CC-cc} $opt -xc /dev/null -S -o /dev/null]); then
+      submachine_opt="$opt"
+      break
+    fi
+  done])
+  if test "x$submachine_opt" = xno; then
+    AC_MSG_ERROR([${CC-cc} does not support $submachine])
+  fi
+fi
 
 # This tells us whether we know we have a hardware decimal floating point
 # unit.  We know this based upon the submachine.
@@ -198,7 +219,7 @@
 case "$machine" in
 	powerpc) base_machine=powerpc machine=powerpc/powerpc32 cc_msize=32 ;;
 	powerpc64) base_machine=powerpc machine=powerpc/powerpc64 cc_msize=64;;
-	s390) base_machine=s390 machine=s390/s390-32 cc_msize=32;;
+	s390) base_machine=s390 machine=s390/s390-32 cc_msize=31;;
 	s390x) base_machine=s390 machine=s390/s390-64 cc_msize=64;;
 	i[34567]86) base_machine=i386 machine=i386/$machine ;;
 	*) base_machine=$machine ;;
@@ -217,30 +238,34 @@
 AC_SUBST(CC)
 AC_SUBST(cc_msize)
 
+AC_SUBST(CFLAGS)
+AC_SUBST(ASFLAGS)
+
+# TODO replace this with a compiler type check.
 # Don't even bother configuring if the compiler doesn't support Decimal
 # Floating Point.
-AC_CACHE_CHECK(for decimal-float-support in compiler,
-	       libdfp_cv_cc_with_decimal_float, [
-		cat > conftest.c <<EOF
-int main (void) { _Decimal64 d64; d64 = 1.0DD; return 0; }
-EOF
-  if ${CC} ${CFLAGS} ${CPPFLAGS} $LDFLAGS -static -o conftest \
-       conftest.c -v 2>&1 >/dev/null | grep -q " --enable-decimal-float ";
-  then
-    libdfp_cv_cc_with_decimal_float=yes
-  else
-    libdfp_cv_cc_with_decimal_float=no
-    AC_MSG_WARN([CC is ${CC}])
-    AC_MSG_ERROR([${PACKAGE_NAME} requires a compiler configured and built
-		  with --enable-decimal-float.])
-  fi
-  rm -f conftest*])
-AC_SUBST(libdfp_cv_cc_with_decimal_float)
-if test $libdfp_cv_cc_with_decimal_float = yes; then
-  cat >> confdefs.h <<\EOF
-#define __STDC_DEC_FP__ 200704L
-EOF
-fi
+#AC_CACHE_CHECK(for decimal-float-support in compiler,
+#	       libdfp_cv_cc_with_decimal_float, [
+#		cat > conftest.c <<EOF
+#int main (void) { _Decimal64 d64; d64 = 1.0DD; return 0; }
+#EOF
+#  if ${CC} ${CFLAGS} ${CPPFLAGS} $LDFLAGS -static -o conftest \
+#       conftest.c -v 2>&1 >/dev/null | grep -q " --enable-decimal-float ";
+#  then
+#    libdfp_cv_cc_with_decimal_float=yes
+#  else
+#    libdfp_cv_cc_with_decimal_float=no
+#    AC_MSG_WARN([CC is ${CC}])
+#    AC_MSG_ERROR([${PACKAGE_NAME} requires a compiler configured and built
+#		  with --enable-decimal-float.])
+#  fi
+#  rm -f conftest*])
+#AC_SUBST(libdfp_cv_cc_with_decimal_float)
+#if test $libdfp_cv_cc_with_decimal_float = yes; then
+#  cat >> confdefs.h <<\EOF
+##define __STDC_DEC_FP__ 200704L
+#EOF
+#fi
 
 glibc_headers=
 AC_ARG_WITH([glibc-headers],

Modified: libdfp/trunk/ieee754r/Versions
==============================================================================
--- libdfp/trunk/ieee754r/Versions (original)
+++ libdfp/trunk/ieee754r/Versions Wed Dec  9 14:57:47 2009
@@ -1,5 +1,5 @@
 libdfp {
-  LIBDFP_0.0.1 {
+  LIBDFP_1.0.0 {
     acosd32;
     acosd64;
     acosd128;

Modified: libdfp/trunk/ieee754r/frexpd32.c
==============================================================================
--- libdfp/trunk/ieee754r/frexpd32.c (original)
+++ libdfp/trunk/ieee754r/frexpd32.c Wed Dec  9 14:57:47 2009
@@ -42,7 +42,10 @@
 DEC_TYPE
 INTERNAL_FUNCTION_NAME (DEC_TYPE x, int *y)
 {
-  DEC_TYPE result;
+  /* GCC isn't smart enough to realize that the else block sets this in the
+   * FUNC_CONVERT_FROM_DN macro so simply initialize it to NaN to silence the
+   * warnings.  */
+  DEC_TYPE result = DEC_NAN;
 
 #if NUMDIGITS_SUPPORT==1
   int digits, exponent;
@@ -50,14 +53,32 @@
   if (isinf(x) || isnan(x))
     return x+x;
 
+  // Given 3.1e0 is encoded as 31e-1 and we want .31e1
+  // We have 2 'digits'.
+
+  // Given 30.0e0 is encoded as 300e-1 and we want .300e2
+  // We have 3 'digits'.
+
+  // Given .003e0 is encoded as 3e3 and we want .3e-2
+  // We have 1 'digits'.
+
   digits = FUNC_D (numdigits) (x);
+
+  // We have -1 exponent.
+
+  // We have -1 exponent.
+
+  // We have -3 exponent.
+
   exponent = FUNC_D (getexp) (x);
   *y = digits + exponent;
 
-  /* I think this was an error.  */
-  /*result = FUNC_D(setexp) (result, -digits); */
+  result = FUNC_D(setexp) (x, -digits);
+  //2 + (-1) = 1   0
 
-  result = FUNC_D(setexp) (x, -digits);
+  //3 + (-1) = 2   0
+
+  //1 + (-3) = -2
 
 #else
   decNumber dn_x;

Modified: libdfp/trunk/ieee754r/powd32.c
==============================================================================
--- libdfp/trunk/ieee754r/powd32.c (original)
+++ libdfp/trunk/ieee754r/powd32.c Wed Dec  9 14:57:47 2009
@@ -161,7 +161,7 @@
       DFP_ERRNO (ERANGE);
   if (!FUNC_D(__finite) (z) && FUNC_D(__finite) (x) && FUNC_D(__finite) (y))
     {
-      if (__isnan(z)) /*  Domain error was triggered, x < 0 and y was not an
+      if (FUNC_D(__isnan) (z)) /*  Domain error was triggered, x < 0 and y was not an
 			odd int */
 	DFP_ERRNO (EDOM);
       else	/*  Overflow */

Modified: libdfp/trunk/strtod32.c
==============================================================================
--- libdfp/trunk/strtod32.c (original)
+++ libdfp/trunk/strtod32.c Wed Dec  9 14:57:47 2009
@@ -928,7 +928,6 @@
     {
       /* Read the decimal part as a FLOAT.  */
       int digcnt = dig_no - int_no;
-//      FLOAT frac = FLOAT_ZERO;
       
   /* There might be radix characters in
 	    the string.  But these all can be ignored because we know the

Modified: libdfp/trunk/sysdeps/bid/Versions
==============================================================================
--- libdfp/trunk/sysdeps/bid/Versions (original)
+++ libdfp/trunk/sysdeps/bid/Versions Wed Dec  9 14:57:47 2009
@@ -2,7 +2,7 @@
 # C source files don't indicate "__bid" in the filename and they
 # live in the common base-math/ directory.
 libdfp {
-  LIBDFP_0.0.1 {
+  LIBDFP_1.0.0 {
     __bid_addsd3; __bid_adddd3; __bid_addtd3;
     __bid_subsd3; __bid_subdd3; __bid_subtd3;
     __bid_mulsd3; __bid_muldd3; __bid_multd3;

Modified: libdfp/trunk/sysdeps/dpd/Versions
==============================================================================
--- libdfp/trunk/sysdeps/dpd/Versions (original)
+++ libdfp/trunk/sysdeps/dpd/Versions Wed Dec  9 14:57:47 2009
@@ -2,7 +2,7 @@
 # C source files don't indicate "__dpd" in the filename and they
 # live in the common base-math/ directory.
 libdfp {
-  LIBDFP_0.0.1 {
+  LIBDFP_1.0.0 {
     __dpd_addsd3; __dpd_adddd3; __dpd_addtd3;
     __dpd_subsd3; __dpd_subdd3; __dpd_subtd3;
     __dpd_mulsd3; __dpd_muldd3; __dpd_multd3;

Modified: libdfp/trunk/sysdeps/dpd/dpd-private.c
==============================================================================
--- libdfp/trunk/sysdeps/dpd/dpd-private.c (original)
+++ libdfp/trunk/sysdeps/dpd/dpd-private.c Wed Dec  9 14:57:47 2009
@@ -744,7 +744,7 @@
 __get_digits_d32 (_Decimal32 x, char *str, int *exp_p, int *sign_p, 
 		  int *nan_p, int *inf_p)
 {
-  int exp;
+  int exp = 0;
   struct ieee754r_c_field c_f;
   union ieee754r_Decimal32 d;
   d.sd = x;
@@ -768,7 +768,7 @@
 __get_digits_d64 (_Decimal64 x, char *str, int *exp_p, int *sign_p, 
 		  int *nan_p, int *inf_p)
 {
-  int exp;
+  int exp = 0;
   struct ieee754r_c_field c_f;
   union ieee754r_Decimal64 d;
   d.dd = x;
@@ -796,7 +796,7 @@
 __get_digits_d128 (_Decimal128 x, char *str, int *exp_p, int *sign_p, 
 		   int *nan_p, int *inf_p)
 {
-  int exp;
+  int exp = 0;
   struct ieee754r_c_field c_f;
   union ieee754r_Decimal128 d;
   d.td = x;

Modified: libdfp/trunk/sysdeps/powerpc/dfpu/numdigits.h
==============================================================================
--- libdfp/trunk/sysdeps/powerpc/dfpu/numdigits.h (original)
+++ libdfp/trunk/sysdeps/powerpc/dfpu/numdigits.h Wed Dec  9 14:57:47 2009
@@ -133,7 +133,11 @@
 #endif
   union {
     int i[2];
-    double f;
+#if _DECIMAL_SIZE == 128
+    _Decimal128 f;
+#else
+    _Decimal64 f; /* promote _Decimal32 -> _Decimal64  */
+#endif
   } a, b, one;
   
   one.i[0] = 0;
@@ -141,18 +145,18 @@
   
   asm (
 #if _DECIMAL_SIZE == 32
-    "dctdp %0,%0\n\t"
+    "dctdp %2,%2\n\t"
 #endif
 #if _DECIMAL_SIZE != 128
-    "dxex %1,%0\n\t"
-    "drrnd %0,%4,%0,1\n\t"
-    "dxex %2,%0\n\t"
+    "dxex %0,%2\n\t"
+    "drrnd %1,%3,%2,1\n\t"
+    "dxex %1,%1\n\t"
 #else /* _DECIMAL_SIZE == 128 */
-    "dxexq %1,%0\n\t"
-    "drrndq %0,%4,%0,1\n\t"
-    "dxexq %2,%0\n\t"
-#endif
-   : "=f"(tmp), "=f"(a.f), "=f"(b.f) : "0"(tmp), "f"(one.f));
+    "dxexq %0,%2\n\t"
+    "drrndq %1,%3,%2,1\n\t"
+    "dxexq %1,%1\n\t"
+#endif
+   : "+f"(a.f), "+f"(b.f) : "f"(tmp), "f"(one.f));
 //  printf("a: %lld  b: %lld\n", a.i, b.i);
   return b.i[1] - a.i[1] + 1;
 }
@@ -170,6 +174,12 @@
     int i[2];
     double f;
   } d;
+/* Should double f; be replaced with the following for left_justify as well?  */
+//#if _DECIMAL_SIZE == 128
+//    _Decimal128 f;
+//#else
+//    _Decimal64 f; /* promote _Decimal32 -> _Decimal64  */
+//#endif
 
   d.i[0] = 0;
   d.i[1] = 1;

Added: libdfp/trunk/sysdeps/s390/fpu/fenv_libdfp.h
==============================================================================
--- libdfp/trunk/sysdeps/s390/fpu/fenv_libdfp.h (added)
+++ libdfp/trunk/sysdeps/s390/fpu/fenv_libdfp.h Wed Dec  9 14:57:47 2009
@@ -1,0 +1,49 @@
+/* s390 fenv macros.
+
+   Copyright (C) 2000, 2008, 2009 Free Software Foundation, Inc.
+
+   This file is part of the Decimal Floating Point C Library.
+
+   Author(s): Andreas Krebbel  <Andreas.Krebbel@xxxxxxxxxx>
+
+   The Decimal Floating Point C Library is free software; you can
+   redistribute it and/or modify it under the terms of the GNU Lesser
+   General Public License version 2.1.
+
+   The Decimal Floating Point C Library is distributed in the hope that
+   it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+   the GNU Lesser General Public License version 2.1 for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License version 2.1 along with the Decimal Floating Point C Library;
+   if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+   Suite 330, Boston, MA 02111-1307 USA.
+
+   Please see libdfp/COPYING.txt for more information.  */
+
+#ifndef _FENV_LIBDFP_H
+#define _FENV_LIBDFP_H    1
+
+/* Based on the binary floating point variants contributed
+   by Denis Joseph Barrow (djbarrow@xxxxxxxxxx).  */
+
+#include <fenv.h>
+
+/* Definitions from asm/s390-regs-common.h that are needed in glibc.  */
+
+
+#define FPC_EXCEPTION_MASK	0xF8000000
+#define FPC_FLAGS_MASK		0x00F80000
+#define FPC_DXC_MASK		0x0000FF00
+#define FPC_RM_MASK		0x00000003
+#define FPC_DFP_RM_MASK		0x00000070
+#define FPC_VALID_MASK		((FPC_EXCEPTION_MASK|FPC_FLAGS_MASK| \
+				 FPC_DXC_MASK|FPC_BFP_RM_MASK|FPC_DFP_RM_MASK))
+
+#define FPC_EXCEPTION_MASK_SHIFT	24
+#define FPC_FLAGS_SHIFT			16
+#define FPC_DXC_SHIFT			8
+#define FPC_NOT_FPU_EXCEPTION		0x300
+
+#endif /* _FENV_LIBDFP_H */

Modified: libdfp/trunk/sysdeps/soft-dfp/Versions
==============================================================================
--- libdfp/trunk/sysdeps/soft-dfp/Versions (original)
+++ libdfp/trunk/sysdeps/soft-dfp/Versions Wed Dec  9 14:57:47 2009
@@ -2,6 +2,6 @@
   LIBDFP_PRIVATE {
     __decrm_location;
   }
-  LIBDFP_0.0.1 {
+  LIBDFP_1.0.0 {
   }
 }

Modified: libdfp/trunk/sysdeps/soft-dfp/bid/Versions
==============================================================================
--- libdfp/trunk/sysdeps/soft-dfp/bid/Versions (original)
+++ libdfp/trunk/sysdeps/soft-dfp/bid/Versions Wed Dec  9 14:57:47 2009
@@ -1,5 +1,5 @@
 libdfp {
-  LIBDFP_0.0.1 {
+  LIBDFP_1.0.0 {
     __bid_extendsfsd; __bid_extendsddf; __bid_extendsdtf;
     __bid_extendsfdd; __bid_extenddfdd; __bid_extendddtf;
     __bid_extendsftd; __bid_extenddftd; __bid_extendtftd;

Modified: libdfp/trunk/sysdeps/soft-dfp/dpd/Versions
==============================================================================
--- libdfp/trunk/sysdeps/soft-dfp/dpd/Versions (original)
+++ libdfp/trunk/sysdeps/soft-dfp/dpd/Versions Wed Dec  9 14:57:47 2009
@@ -1,5 +1,5 @@
 libdfp {
-  LIBDFP_0.0.1 {
+  LIBDFP_1.0.0 {
     __dpd_extendsfsd; __dpd_extendsddf; __dpd_extendsdtf;
     __dpd_extendsfdd; __dpd_extenddfdd; __dpd_extendddtf;
     __dpd_extendsftd; __dpd_extenddftd; __dpd_extendtftd;

Modified: libdfp/trunk/sysdeps/soft-dfp/dpd/numdigits.h
==============================================================================
--- libdfp/trunk/sysdeps/soft-dfp/dpd/numdigits.h (original)
+++ libdfp/trunk/sysdeps/soft-dfp/dpd/numdigits.h Wed Dec  9 14:57:47 2009
@@ -223,7 +223,7 @@
       /* pad the significant digits with enough trailing zeroes */
       memset(digits + firstdigit + len, '0', firstdigit);
       x = setdigits(x, digits + firstdigit);
-      x = FUNC_D(setexp) (x, FUNC_D (getexp(x)) - firstdigit);
+      x = FUNC_D(setexp) (x, FUNC_D (getexp) (x) - firstdigit);
     }
 
   return x;

Modified: libdfp/trunk/tests/TODO
==============================================================================
--- libdfp/trunk/tests/TODO (original)
+++ libdfp/trunk/tests/TODO Wed Dec  9 14:57:47 2009
@@ -1,4 +1,6 @@
-
 
 test-param.c: Have it automate checking the return values and use scaffold.c
 for outputting failure cases.
+
+use genddtbls.c to output a table and compare the results to `ddlogtbls.c'.
+This is a good exercise of the frexp and num-digits code.

Added: libdfp/trunk/tests/decode.h
==============================================================================
--- libdfp/trunk/tests/decode.h (added)
+++ libdfp/trunk/tests/decode.h Wed Dec  9 14:57:47 2009
@@ -1,0 +1,36 @@
+/* Prototypes for decode functions, which output the DPD declets.
+
+   Copyright (C) 2009 Free Software Foundation, Inc.
+
+   This file is part of the Decimal Floating Point C Library.
+
+   Author(s): Ryan S. Arnold <rsa@xxxxxxxxxx>
+
+   The Decimal Floating Point C Library is free software; you can
+   redistribute it and/or modify it under the terms of the GNU Lesser
+   General Public License version 2.1.
+
+   The Decimal Floating Point C Library is distributed in the hope that
+   it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+   the GNU Lesser General Public License version 2.1 for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License version 2.1 along with the Decimal Floating Point C Library;
+   if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+   Suite 330, Boston, MA 02111-1307 USA.
+
+   Please see libdfp/COPYING.txt for more information.  */
+
+#ifndef _DECODE_H
+#define _DECODE_H
+
+/* char * should ref a 14 byte char array, +0,000,000E+0\0  */
+extern char * decoded32 (_Decimal32, char*);
+/* char * should ref a 26 byte char array, +0,000,000,000,000,000E+0\0  */
+extern char * decoded64 (_Decimal64, char*);
+/* char * should ref a 50 byte char array, *
+ * +0,000,000,000,000,000,000,000,000,000,000,000E+0\0  */
+extern char * decoded128 (_Decimal128, char*);
+
+#endif /* _DECODE_H  */

Modified: libdfp/trunk/tests/scaffold.c
==============================================================================
--- libdfp/trunk/tests/scaffold.c (original)
+++ libdfp/trunk/tests/scaffold.c Wed Dec  9 14:57:47 2009
@@ -48,9 +48,8 @@
 
 #endif /* _C  */
 
+static char buf[CHAR_MAX];
 #ifndef _PC
-
-static char buf[CHAR_MAX];
 
 /* _PC == Printf_dfp Compare with Position  */
 #define _PC_P(f,l,x,y,args...) do { \
@@ -78,6 +77,43 @@
 #define _PC(x,y,...) _PC_P (__FILE__,__LINE__,x,y,__VA_ARGS__)
 #endif /* _PC  */
 
+
+#ifndef _DC
+
+/* Pick up the decoded[32|64|128] prototypes.  */
+#include "decode.h"
+
+/* _DC == decoded[32|64|128] Compare with Position.  Use this if the position is
+ * pre-determined.  Don't call this on Non-_Decimal values.  The outcome is
+ * undefined.  */
+#define _DC_P(f,l,x,y) do { \
+  memset(buf,'\0',CHAR_MAX); \
+  /* Invoke the correct decoded{32|64|128]() based on arg size.  */ \
+  (sizeof (y) == sizeof (_Decimal128)? decoded128(y,&buf[0]): \
+    (sizeof (y) == sizeof (_Decimal64)? decoded64(y,&buf[0]): \
+       decoded32(y,&buf[0]))); \
+  _C_P(f,l,x,buf); \
+} while (0)
+
+/* _DC == decoded[32|64|128] Compare
+ *
+ * Variadic macro used to compare a decoded[32|64|128]() invocation with an
+ * expected result.
+ *
+ * X: Expected decoded[32|64|128] Output String
+ * Y: _Decimal[32|64|128] Argument
+ *
+ * It is like decoded[32|64|128], except you include an 'expected
+ * result' string to precede everything and you don't need to define a buffer.
+ *
+ * e.g.
+ *   _DC("0.000033333", (_Decimal128) 0.00033333DL);
+ *
+ */
+#define _DC(x,y) _DC_P (__FILE__,__LINE__,x,y)
+#endif /* _DC  */
+
+
 #ifndef _REPORT
 /* Don't print anything if there are no failures.  */
 #define _REPORT() do { \

Modified: libdfp/trunk/tests/test-param.c
==============================================================================
--- libdfp/trunk/tests/test-param.c (original)
+++ libdfp/trunk/tests/test-param.c Wed Dec  9 14:57:47 2009
@@ -26,22 +26,38 @@
 #define __STDC_WANT_DEC_FP__
 #endif
 
-#include <stdio.h>
-#include <float.h>
-
 /* This testcase is designed to test that the compiler is satisfying the
  * conditions of the ABI with regard to spilling of _Decimal* type parameters
  * to the stack.  In other words, we verify the integrity of the data after a
  * function call where parameters are spilled.  This should be tested for both
- * hard and soft dfp.  */
+ * hard-dfp and soft-dfp.  */
 
-/* char * should ref a 14 byte char array, +0,000,000E+0\0  */
-extern char * decoded32 (_Decimal32, char*);
-/* char * should ref a 26 byte char array, +0,000,000,000,000,000E+0\0  */
-extern char * decoded64 (_Decimal64, char*);
-/* char * should ref a 50 byte char array, *
- * +0,000,000,000,000,000,000,000,000,000,000,000E+0\0  */
-extern char * decoded128 (_Decimal128, char*);
+#include <stdio.h>
+#include <float.h>
+
+/* Pick up the decoded* headers.  */
+#include "decode.h"
+
+#include "scaffold.c" /* Pick up the _PC(x,y,...) macro.  */
+
+/* Inspired by GLIBC stdio-common/tfformat.c  */
+typedef struct{
+  int line;
+  _Decimal128 d;
+  const char *expect;
+} d128_type;
+
+typedef struct{
+  int line;
+  _Decimal64 d;
+  const char *expect;
+} d64_type;
+
+typedef struct{
+  int line;
+  _Decimal32 d;
+  const char *expect;
+} d32_type;
 
 typedef struct sparm {
   _Decimal32 df;
@@ -49,9 +65,19 @@
   _Decimal128 dl;
 } sparm_t;
 
-/* Test parameter spilling.  */
-int func(_Decimal128 d128, _Decimal64 d64, _Decimal32 d32, struct sparm *s,
-struct sparm *t, _Decimal32 e32, _Decimal64 e64, _Decimal64 z64, _Decimal128 e128, _Decimal64 f64, _Decimal128 f128)
+/* Test parameter spilling.  Use __attribute__ ((unused)) to silence compiler
+ * warnings.  */
+static int param_test(_Decimal128 d128 __attribute__ ((unused)),
+	       _Decimal64 d64 __attribute__ ((unused)),
+	       _Decimal32 d32 __attribute__ ((unused)),
+	       struct sparm *s __attribute__ ((unused)),
+	       struct sparm *t __attribute__ ((unused)),
+	       _Decimal32 e32 __attribute__ ((unused)),
+	       _Decimal64 e64 __attribute__ ((unused)),
+	       _Decimal64 z64 __attribute__ ((unused)),
+	       _Decimal128 e128,
+	       _Decimal64 f64 __attribute__ ((unused)),
+	       _Decimal128 f128)
 {
   volatile _Decimal128 z;
   volatile _Decimal128 y;
@@ -60,17 +86,88 @@
   return 0;
 }
 
-int main() {
+int main(void) {
   int x;
   struct sparm s, t;
-  char buf[256];
-  _Decimal32 d32,e32 = 4.44444DF;
-  _Decimal64 d64,e64,f64 = 9.99999DD;
-  _Decimal128 d128,e128 = 1.0DL;
-  _Decimal128 f128 = 2.0DL;
 
-  x = func(d128,d64,d32,&s,&t,e32,e64,e64,e128,f64,f128);
-  decoded128(e128,&buf[0]);
-  printf("%s\n",buf);
-  return 0;
+  d32_type d32types[] =
+  {
+#ifdef _DPD_BACKEND
+    {__LINE__,4.44444DF, "+0,444,444E-5"},
+    {__LINE__,1.22222DF, "+0,122,222E-5"},
+#else
+    {__LINE__,4.44444DF, "BID not supported."},
+    {__LINE__,1.22222DF, "BID not supported."},
+#endif
+    {0,0,0 }
+  };
+
+  d64_type d64types[] =
+  {
+#ifdef _DPD_BACKEND
+    {__LINE__,1.99999DD, "+0,000,000,000,199,999E-5"},
+    {__LINE__,2.88888DD, "+0,000,000,000,288,888E-5"},
+    {__LINE__,3.77777DD, "+0,000,000,000,377,777E-5"},
+    {__LINE__,4.66666DD, "+0,000,000,000,466,666E-5"},
+#else
+    {__LINE__,1.99999DD, "BID not supported."},
+    {__LINE__,2.88888DD, "BID not supported."},
+    {__LINE__,3.77777DD, "BID not supported."},
+    {__LINE__,4.66666DD, "BID not supported."},
+#endif
+    {0,0,0 }
+  };
+
+  d128_type d128types[] =
+  {
+#ifdef _DPD_BACKEND
+    {__LINE__,7.0DL, "+0,000,000,000,000,000,000,000,000,000,000,070E-1"},
+    {__LINE__,6.0DL, "+0,000,000,000,000,000,000,000,000,000,000,060E-1"},
+    {__LINE__,5.0DL, "+0,000,000,000,000,000,000,000,000,000,000,050E-1"},
+#else
+    {__LINE__,7.0DL, "BID not supported."},
+    {__LINE__,6.0DL, "BID not supported."},
+    {__LINE__,5.0DL, "BID not supported."},
+#endif
+    {0,0,0 }
+  };
+
+  /* We're not going to check these.  They're simply filler.  */
+  s.df = 1.22222DF;
+  s.dd = 2.33333DD;
+  s.dl = 3.44444DL;
+
+  t.df = 4.55555DF;
+  t.dd = 5.66666DD;
+  t.dl = 6.77777DL;
+
+  /* This may seem like a trivial test but the compiler screwed this up at one
+   * point and it'd be nice to not have this ever regress without us knowing it.
+   */
+  x = param_test(d128types[0].d,d64types[0].d,d32types[0].d,&s,&t,d32types[1].d,d64types[1].d,d64types[2].d,d128types[1].d,d64types[3].d,d128types[2].d);
+
+  /* Make sure the compiler hasn't screwed up the save/restore of these
+   * _Decimal types.  */
+  d32_type *d32p;
+  for (d32p = d32types; d32p->line; d32p++)
+    {
+      _DC_P(__FILE__,d32p->line, d32p->expect,d32p->d);
+    }
+
+  d64_type *d64p;
+  for (d64p = d64types; d64p->line; d64p++)
+    {
+      _DC_P(__FILE__,d64p->line, d64p->expect,d64p->d);
+    }
+
+  d128_type *d128p;
+  for (d128p = d128types; d128p->line; d128p++)
+    {
+      _DC_P(__FILE__,d128p->line, d128p->expect,d128p->d);
+    }
+
+  _REPORT();
+
+  /* fail comes from scaffold.c  */
+  return fail;
 }

Modified: libdfp/trunk/tests/test-printf.c
==============================================================================
--- libdfp/trunk/tests/test-printf.c (original)
+++ libdfp/trunk/tests/test-printf.c Wed Dec  9 14:57:47 2009
@@ -49,14 +49,13 @@
   /* Four digits of precision right of the decimal place.  */
   {__LINE__, 231.2315DL, "231.2315", "%.4DDf"},
   /* Space padded to 12,  Right justified.  */
-  {__LINE__, 231.2315DL, "12.3", "%12.3DDf"},
+  {__LINE__, 231.2315DL, "     231.232", "%12.3DDf"},
   /* Left justified, Space padded to 12.  */
-  {__LINE__, 231.2315DL, "12.3", "%-12.3DDf"},
-
+  {__LINE__, 231.2315DL, "231.232     ", "%-12.3DDf"},
   {0,0,0,0 }
 };
 
-int main (int argc, char ** argv)
+int main (void)
 {
   d128_type *dptr;
 
@@ -77,5 +76,6 @@
 
   _REPORT();
 
+  /* fail comes from scaffold.c  */
   return fail;
 }