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

[commits] r6980 - in /branches/libdfp/libc/dfp: ./ sysdeps/dfp/ sysdeps/ieee754r/ sysdeps/powerpc/ sysdeps/powerpc/dfpu/ sysdeps/soft-...



Author: eberlein
Date: Fri Sep 19 16:23:12 2008
New Revision: 6980

Log:
2008-09-19  Pete Eberlein  <eberlein@xxxxxxxxxx>

	* dfp/Makefile: Use bid or dpd decnumber includes.  Remove 
	dpd-private and decode-decimal from libdfp-shared.
	* dfp/sysdeps/powerpc/decode-decimal.c: Moved to soft-dfp/dpd.
	* dfp/sysdeps/powerpc/dpd-private.c: Ditto.
	* dfp/sysdeps/powerpc/dpd-private.h: Ditto.
	* dfp/sysdeps/powerpc/numdigits.h: Ditto.
	* dfp/sysdeps/powerpc/dfpu/fe_decround.c: Modified for 64-bit
	fpscr.
	* dfp/sysdeps/soft-dfp/convert.h 
	(PREFIXED_FUNCTION_NAME): New macro.
	(CONVERT_WRAPPER): New macro.
	(DFP_TEST_EXCEPTIONS): Conditionalized on fegetenv_register.
	(DFP_CLEAR_EXCEPTIONS): Ditto.
	* dfp/sysdeps/soft-dfp/eqdd2.c: Uses the prefixed function
	name.  Updated copyright year.
	* dfp/sysdeps/soft-dfp/floatunsditd.c: Ditto.
	* dfp/sysdeps/soft-dfp/fixunstdsi.c: Ditto.
	* dfp/sysdeps/soft-dfp/subsd3.c: Ditto.
	* dfp/sysdeps/soft-dfp/gesd2.c: Ditto.
	* dfp/sysdeps/soft-dfp/subtd3.c: Ditto.
	* dfp/sysdeps/soft-dfp/getd2.c: Ditto.
	* dfp/sysdeps/soft-dfp/mulsd3.c: Ditto.
	* dfp/sysdeps/soft-dfp/extendsddd2.c: Ditto.
	* dfp/sysdeps/soft-dfp/extendsdtf.c: Ditto.
	* dfp/sysdeps/soft-dfp/extendsftd.c: Ditto.
	* dfp/sysdeps/soft-dfp/multd3.c: Ditto.
	* dfp/sysdeps/soft-dfp/floatdisd.c: Ditto.
	* dfp/sysdeps/soft-dfp/extenddfdd.c: Ditto.
	* dfp/sysdeps/soft-dfp/fixtdsi.c: Ditto.
	* dfp/sysdeps/soft-dfp/truncddsd2.c: Ditto.
	* dfp/sysdeps/soft-dfp/trunctdsf.c: Ditto.
	* dfp/sysdeps/soft-dfp/trunctfsd.c: Ditto.
	* dfp/sysdeps/soft-dfp/trunctddd2.c: Ditto.
	* dfp/sysdeps/soft-dfp/floatunssisd.c: Ditto.
	* dfp/sysdeps/soft-dfp/eqsd2.c: Ditto.
	* dfp/sysdeps/soft-dfp/eqtd2.c: Ditto.
	* dfp/sysdeps/soft-dfp/adddd3.c: Ditto.
	* dfp/sysdeps/soft-dfp/extendsdtd2.c: Ditto.
	* dfp/sysdeps/soft-dfp/extendddtf.c: Ditto.
	* dfp/sysdeps/soft-dfp/extenddftd.c: Ditto.
	* dfp/sysdeps/soft-dfp/trunctdsd2.c: Ditto.
	* dfp/sysdeps/soft-dfp/floatunsdisd.c: Ditto.
	* dfp/sysdeps/soft-dfp/addsd3.c: Ditto.
	* dfp/sysdeps/soft-dfp/addtd3.c: Ditto.
	* dfp/sysdeps/soft-dfp/extendsfsd.c: Ditto.
	* dfp/sysdeps/soft-dfp/extendtftd.c: Ditto.
	* dfp/sysdeps/soft-dfp/ltdd2.c: Ditto.
	* dfp/sysdeps/soft-dfp/fixunssddi.c: Ditto.
	* dfp/sysdeps/soft-dfp/unorddd2.c: Ditto.
	* dfp/sysdeps/soft-dfp/ltsd2.c: Ditto.
	* dfp/sysdeps/soft-dfp/lttd2.c: Ditto.
	* dfp/sysdeps/soft-dfp/fixsddi.c: Ditto.
	* dfp/sysdeps/soft-dfp/ledd2.c: Ditto.
	* dfp/sysdeps/soft-dfp/nedd2.c: Ditto.
	* dfp/sysdeps/soft-dfp/unordsd2.c: Ditto.
	* dfp/sysdeps/soft-dfp/fixunsdddi.c: Ditto.
	* dfp/sysdeps/soft-dfp/unordtd2.c: Ditto.
	* dfp/sysdeps/soft-dfp/floatsidd.c: Ditto.
	* dfp/sysdeps/soft-dfp/extendddtd2.c: Ditto.
	* dfp/sysdeps/soft-dfp/lesd2.c: Ditto.
	* dfp/sysdeps/soft-dfp/letd2.c: Ditto.
	* dfp/sysdeps/soft-dfp/fixdddi.c: Ditto.
	* dfp/sysdeps/soft-dfp/nesd2.c: Ditto.
	* dfp/sysdeps/soft-dfp/netd2.c: Ditto.
	* dfp/sysdeps/soft-dfp/divdd3.c: Ditto.
	* dfp/sysdeps/soft-dfp/truncdddf.c: Ditto.
	* dfp/sysdeps/soft-dfp/fixunstddi.c: Ditto.
	* dfp/sysdeps/soft-dfp/floatsitd.c: Ditto.
	* dfp/sysdeps/soft-dfp/floatdidd.c: Ditto.
	* dfp/sysdeps/soft-dfp/fixtddi.c: Ditto.
	* dfp/sysdeps/soft-dfp/divsd3.c: Ditto.
	* dfp/sysdeps/soft-dfp/divtd3.c: Ditto.
	* dfp/sysdeps/soft-dfp/trunctddf.c: Ditto.
	* dfp/sysdeps/soft-dfp/trunctfdd.c: Ditto.
	* dfp/sysdeps/soft-dfp/floatunssidd.c: Ditto.
	* dfp/sysdeps/soft-dfp/fixunssdsi.c: Ditto.
	* dfp/sysdeps/soft-dfp/gtdd2.c: Ditto.
	* dfp/sysdeps/soft-dfp/fixsdsi.c: Ditto.
	* dfp/sysdeps/soft-dfp/floatditd.c: Ditto.
	* dfp/sysdeps/soft-dfp/truncsdsf.c: Ditto.
	* dfp/sysdeps/soft-dfp/trunctdtf.c: Ditto.
	* dfp/sysdeps/soft-dfp/floatunssitd.c: Ditto.
	* dfp/sysdeps/soft-dfp/floatunsdidd.c: Ditto.
	* dfp/sysdeps/soft-dfp/fixunsddsi.c: Ditto.
	* dfp/sysdeps/soft-dfp/gtsd2.c: Ditto.
	* dfp/sysdeps/soft-dfp/gttd2.c: Ditto.
	* dfp/sysdeps/soft-dfp/subdd3.c: Ditto.
	* dfp/sysdeps/soft-dfp/gedd2.c: Ditto.
	* dfp/sysdeps/soft-dfp/floatsisd.c: Ditto.
	* dfp/sysdeps/soft-dfp/extendsddf.c: Ditto.
	* dfp/sysdeps/soft-dfp/extendsfdd.c: Ditto.
	* dfp/sysdeps/soft-dfp/muldd3.c: Ditto.
	* dfp/sysdeps/soft-dfp/fixddsi.c: Ditto.
	* dfp/sysdeps/soft-dfp/truncddsf.c: Ditto.
	* dfp/sysdeps/soft-dfp/truncdfsd.c: Ditto.
	* dfp/sysdeps/soft-dfp/extend2.c: Deleted.
	* dfp/sysdeps/soft-dfp/extendtfdd.c: Deleted.
	* dfp/sysdeps/soft-dfp/convert.c: Deleted.
	* dfp/sysdeps/soft-dfp/Versions: Moved to bid/ and dpd/
	subdirectory.
	* dfp/sysdeps/soft-dfp/makecfiles.sh: Deleted.
	* dfp/sysdeps/soft-dfp/dpd/dpd-private.c: Moved from 
	sysdeps/powerpc.
	* dfp/sysdeps/soft-dfp/dpd/decode-decimal.c: Moved from
	sysdeps/powerpc.
	* dfp/sysdeps/soft-dfp/dpd/dpd-private.h: Moved from 
	sysdeps/powerpc.
	* dfp/sysdeps/soft-dfp/dpd/numdigits.h: Moved from 
	sysdeps/powerpc.
	* dfp/sysdeps/soft-dfp/dpd/Versions: Moved from .. and 
	prefixed symbols with __dpd_.
	* dfp/sysdeps/soft-dfp/bid/Versions: Moved from .. and 
	prefixed symbols with __bid_.
	* dfp/sysdeps/unix/sysv/linux/s390/Implies: Points to 
	soft-dfp/dpd.
	* dfp/sysdeps/dfp/configure.in: Get which dfp format gcc 
	supports into $(decimal-format).
	* dfp/sysdeps/ieee754r/dfpmacro.h (PREFIXED_FUNCTION_NAME): 
	New macro.



Added:
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/bid/
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/bid/Versions
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/dpd/
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/dpd/Versions
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/dpd/decode-decimal.c
      - copied unchanged from r4233, branches/libdfp/libc/dfp/sysdeps/powerpc/decode-decimal.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/dpd/dpd-private.c
      - copied unchanged from r5731, branches/libdfp/libc/dfp/sysdeps/powerpc/dpd-private.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/dpd/dpd-private.h
      - copied unchanged from r5731, branches/libdfp/libc/dfp/sysdeps/powerpc/dpd-private.h
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/dpd/numdigits.h
      - copied unchanged from r6075, branches/libdfp/libc/dfp/sysdeps/powerpc/numdigits.h
Removed:
    branches/libdfp/libc/dfp/sysdeps/powerpc/decode-decimal.c
    branches/libdfp/libc/dfp/sysdeps/powerpc/dpd-private.c
    branches/libdfp/libc/dfp/sysdeps/powerpc/dpd-private.h
    branches/libdfp/libc/dfp/sysdeps/powerpc/numdigits.h
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/Versions
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/convert.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/extend2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendtfdd.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/makecfiles.sh
Modified:
    branches/libdfp/libc/dfp/Makefile
    branches/libdfp/libc/dfp/sysdeps/dfp/configure.in
    branches/libdfp/libc/dfp/sysdeps/ieee754r/dfpmacro.h
    branches/libdfp/libc/dfp/sysdeps/powerpc/dfpu/fe_decround.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/adddd3.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/addsd3.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/addtd3.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/convert.h
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/divdd3.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/divsd3.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/divtd3.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/eqdd2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/eqsd2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/eqtd2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendddtd2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendddtf.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/extenddfdd.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/extenddftd.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsddd2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsddf.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsdtd2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsdtf.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsfdd.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsfsd.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsftd.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendtftd.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixdddi.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixddsi.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixsddi.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixsdsi.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixtddi.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixtdsi.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixunsdddi.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixunsddsi.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixunssddi.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixunssdsi.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixunstddi.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixunstdsi.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatdidd.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatdisd.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatditd.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatsidd.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatsisd.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatsitd.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatunsdidd.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatunsdisd.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatunsditd.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatunssidd.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatunssisd.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatunssitd.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/gedd2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/gesd2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/getd2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/gtdd2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/gtsd2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/gttd2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/ledd2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/lesd2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/letd2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/ltdd2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/ltsd2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/lttd2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/muldd3.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/mulsd3.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/multd3.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/nedd2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/nesd2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/netd2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/subdd3.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/subsd3.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/subtd3.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/truncdddf.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/truncddsd2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/truncddsf.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/truncdfsd.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/truncsdsf.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctddd2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctddf.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctdsd2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctdsf.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctdtf.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctfdd.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctfsd.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/unorddd2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/unordsd2.c
    branches/libdfp/libc/dfp/sysdeps/soft-dfp/unordtd2.c
    branches/libdfp/libc/dfp/sysdeps/unix/sysv/linux/s390/Implies

Modified: branches/libdfp/libc/dfp/Makefile
==============================================================================
--- branches/libdfp/libc/dfp/Makefile (original)
+++ branches/libdfp/libc/dfp/Makefile Fri Sep 19 16:23:12 2008
@@ -2,35 +2,21 @@
 
 headers		:= bits/dfpfenv.h bits/dfpcalls.h
 
-# Build the -ldfp and -libdecnumber libraries.
+# Build the -ldfp library.
 
 extra-libs := libdfp
-#extra-libs := libdfp libdecnumber
 extra-libs-others := $(extra-libs)
-# install-lib-ldscripts := libdfp.so
+
+include ../Makeconfig
 
 # The libdecnumber code is in the libdecnumber/ directory.
-vpath %.c libdecnumber:libdecnumber/dpd
-vpath %.h libdecnumber:libdecnumber/dpd
+vpath %.c libdecnumber:libdecnumber/$(decimal-format)
+vpath %.h libdecnumber:libdecnumber/$(decimal-format)
 
 
 # Some symbols need to be in libdfp.so as well as libc.
-libdfp-shared = dfptypeconv decode-decimal \
-	dpd-private
-# \
-#	decNumber decimal32 decimal64 decimal128 decContext
-
-# The libdecnumber printing functions need to be in libc.so as well as
-# libdecnumber.
-#libdecnumber-shared = decNumber decimal32 decimal64 decimal128 decContext
-
-
-#sysd-rules-patterns += libc_%:%
-
-include ../Makeconfig
-
-# libDecNumber contains some functionality which isn't needed in libc.
-#libdecnumber-routines := $(libdecnumber-shared) decNumberMath
+libdfp-shared = dfptypeconv
+
 
 # These get added to libdfp.  Anything in $(libdfp-shared) gets
 # added to libc.so as well because they're the printf helpers.
@@ -117,8 +103,8 @@
 # Will only apply to those C files being built into libdfp
 ifeq ($(subdir), dfp)
 sysdep-CFLAGS += -D__STDC_WANT_DEC_FP__=1 \
-	-I../dfp/libdecnumber -I../dfp/libdecnumber/dpd
-CFLAGS-printf_dfp.c += -O1 -fno-tree-ter
+	-I../dfp/libdecnumber \
+	-I../dfp/libdecnumber/$(decimal-format)
 endif
 
 ifneq ($(subdir), dfp)

Modified: branches/libdfp/libc/dfp/sysdeps/dfp/configure.in
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/dfp/configure.in (original)
+++ branches/libdfp/libc/dfp/sysdeps/dfp/configure.in Fri Sep 19 16:23:12 2008
@@ -12,3 +12,18 @@
 if test $libc_cv_cc_with_decimal_float = no; then
   AC_MSG_ERROR([The dfp add-on requires a compiler with --enable-decimal-float configured.])
 fi
+
+dnl which decimal format is the compiler using
+AC_CACHE_CHECK(which decimal format to use,
+               libc_cv_cc_decimal_format, [
+  if ${CC-cc} -E -dD -std=gnu99 -o - -xc /dev/null | grep -q "__DECIMAL_BID_FORMAT__"; then
+    libc_cv_cc_decimal_format=bid
+  else
+    libc_cv_cc_decimal_format=dpd
+  fi ])
+AC_SUBST(libc_cv_cc_decimal_format)
+
+dnl Define decimal-format in config.make
+config_vars="$config_vars
+decimal-format = $libc_cv_cc_decimal_format"
+

Modified: branches/libdfp/libc/dfp/sysdeps/ieee754r/dfpmacro.h
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/ieee754r/dfpmacro.h (original)
+++ branches/libdfp/libc/dfp/sysdeps/ieee754r/dfpmacro.h Fri Sep 19 16:23:12 2008
@@ -107,6 +107,15 @@
  * the INTERNAL_FUNCTION_NAME will be the errno wrapper */
 #define IEEE_FUNCTION_NAME	PASTE(__ieee743r_,EXTERNAL_FUNCTION_NAME)
 
+/* Functions will need to be prefixed with __bid_ or __dpd_ depending on
+ * how GCC was configured. --enable-decimal-float=[bid,dpd] */
+#if __DECIMAL_BID_FORMAT__==1
+#define PREFIXED_FUNCTION_NAME  PASTE(__bid_,ACTUAL_FUNCTION_NAME)
+#else
+#define PREFIXED_FUNCTION_NAME  PASTE(__dfp_,ACTUAL_FUNCTION_NAME)
+#endif
+
+
 /* Use this if you need to refer to the type appropriate function
  * elswhere. For example FUNC_D (fabs) (x) may be needed in asin
  * FUNC_D(fabs) (x) will resolve to fabsd32 (x) in the 32 bit version */
@@ -147,3 +156,4 @@
 #define PASTE2(x,y) x##y
 
 
+

Modified: branches/libdfp/libc/dfp/sysdeps/powerpc/dfpu/fe_decround.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/powerpc/dfpu/fe_decround.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/powerpc/dfpu/fe_decround.c Fri Sep 19 16:23:12 2008
@@ -103,7 +103,7 @@
 {
   union {
     double as_double;
-    struct { unsigned int dummy: 29, drn:3; };
+    struct { unsigned int dummy, dummy2: 28, drn:3; };
   } fpscr;
 
   /* On Power6, read the fpscr into a double union using mffs

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/adddd3.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/adddd3.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/adddd3.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal64 addition for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -21,7 +21,7 @@
 
 
 #define _DECIMAL_SIZE 64
-#define ACTUAL_FUNCTION_NAME __adddd3
+#define ACTUAL_FUNCTION_NAME adddd3
 #include <decimal64.h>
 
 #include "addsd3.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/addsd3.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/addsd3.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/addsd3.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal32 addition for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -23,7 +23,7 @@
 #ifndef _DECIMAL_SIZE
 #  include <decimal32.h>
 #  define _DECIMAL_SIZE 32
-#  define ACTUAL_FUNCTION_NAME __addsd3
+#  define ACTUAL_FUNCTION_NAME addsd3
 #endif
 
 #include <decContext.h>
@@ -34,7 +34,7 @@
 
 #include <dfpmacro.h>
 DEC_TYPE
-ACTUAL_FUNCTION_NAME (DEC_TYPE x, DEC_TYPE y)
+PREFIXED_FUNCTION_NAME (DEC_TYPE x, DEC_TYPE y)
 {
   DEC_TYPE result;
   decNumber dn_x, dn_y, dn_result;

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/addtd3.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/addtd3.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/addtd3.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal128 addition for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -21,7 +21,7 @@
 
 
 #define _DECIMAL_SIZE 128
-#define ACTUAL_FUNCTION_NAME __addtd3
+#define ACTUAL_FUNCTION_NAME addtd3
 #include <decimal128.h>
 
 #include "addsd3.c"

Added: branches/libdfp/libc/dfp/sysdeps/soft-dfp/bid/Versions
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/bid/Versions (added)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/bid/Versions Fri Sep 19 16:23:12 2008
@@ -1,0 +1,31 @@
+libdfp {
+  GLIBC_2.7 {
+    __bid_addsd3; __bid_adddd3; __bid_addtd3;
+    __bid_subsd3; __bid_subdd3; __bid_subtd3;
+    __bid_mulsd3; __bid_muldd3; __bid_multd3;
+    __bid_divsd3; __bid_divdd3; __bid_divtd3;
+    __bid_eqsd2; __bid_eqdd2; __bid_eqtd2;
+    __bid_nesd2; __bid_nedd2; __bid_netd2;
+    __bid_ltsd2; __bid_ltdd2; __bid_lttd2;
+    __bid_gtsd2; __bid_gtdd2; __bid_gttd2;
+    __bid_lesd2; __bid_ledd2; __bid_letd2;
+    __bid_gesd2; __bid_gedd2; __bid_getd2;
+    __bid_unordsd2; __bid_unorddd2; __bid_unordtd2;
+    __bid_extendsddd2; __bid_extendsdtd2; __bid_extendddtd2;
+    __bid_extendsfsd; __bid_extendsddf; __bid_extendsdtf;
+    __bid_extendsfdd; __bid_extenddfdd; __bid_extendddtf;
+    __bid_extendsftd; __bid_extenddftd; __bid_extendtftd;
+    __bid_trunctdsd2; __bid_truncddsd2; __bid_trunctddd2;
+    __bid_truncsdsf; __bid_truncdfsd; __bid_trunctfsd;
+    __bid_truncddsf; __bid_truncdddf; __bid_trunctfdd;
+    __bid_trunctdsf; __bid_trunctddf; __bid_trunctdtf;
+    __bid_fixsdsi; __bid_fixddsi; __bid_fixtdsi;
+    __bid_fixsddi; __bid_fixdddi; __bid_fixtddi;
+    __bid_fixunssdsi; __bid_fixunsddsi; __bid_fixunstdsi;
+    __bid_fixunssddi; __bid_fixunsdddi; __bid_fixunstddi;
+    __bid_floatsisd; __bid_floatsidd; __bid_floatsitd;
+    __bid_floatdisd; __bid_floatdidd; __bid_floatditd;
+    __bid_floatunssisd; __bid_floatunssidd; __bid_floatunssitd;
+    __bid_floatunsdisd; __bid_floatunsdidd; __bid_floatunsditd;
+  }
+}

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/convert.h
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/convert.h (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/convert.h Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from binary integers, floats and decimal types
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -20,34 +20,36 @@
    Please see dfp/COPYING.txt for more information.  */
 
 
+#include <math.h>
+
 /* decimal source */
 #if defined DECIMAL_TO_INTEGER || defined DECIMAL_TO_BINARY || defined DECIMAL_TO_DECIMAL
 
 #if SRC==32
-#define SRC_TYPE _Decimal32
-#define IEEE_SRC_TYPE decimal32
-#define SRC_LITERAL(n) n##DF
-#define SRC_KIND sd
-#define SIGNBIT __signbitd32
-#define CLASSIFY __fpclassifyd32
+# define SRC_TYPE _Decimal32
+# define IEEE_SRC_TYPE decimal32
+# define SRC_LITERAL(n) n##DF
+# define SRC_KIND sd
+# define SIGNBIT __signbitd32
+# define CLASSIFY __fpclassifyd32
 #endif
 
 #if SRC==64
-#define SRC_TYPE _Decimal64
-#define IEEE_SRC_TYPE decimal64
-#define SRC_LITERAL(n) n##DD
-#define SRC_KIND dd
-#define SIGNBIT __signbitd64
-#define CLASSIFY __fpclassifyd64
+# define SRC_TYPE _Decimal64
+# define IEEE_SRC_TYPE decimal64
+# define SRC_LITERAL(n) n##DD
+# define SRC_KIND dd
+# define SIGNBIT __signbitd64
+# define CLASSIFY __fpclassifyd64
 #endif
 
 #if SRC==128
-#define SRC_TYPE _Decimal128
-#define IEEE_SRC_TYPE decimal128
-#define SRC_LITERAL(n) n##DL
-#define SRC_KIND td
-#define SIGNBIT __signbitd128
-#define CLASSIFY __fpclassifyd128
+# define SRC_TYPE _Decimal128
+# define IEEE_SRC_TYPE decimal128
+# define SRC_LITERAL(n) n##DL
+# define SRC_KIND td
+# define SIGNBIT __signbitd128
+# define CLASSIFY __fpclassifyd128
 #endif
 
 extern int SIGNBIT (SRC_TYPE);
@@ -245,12 +247,20 @@
 #define PASTE(a,b) PASTE2(a,b)
 #define PASTE2(x,y) x##y
 #define PASTE4(a,b,c,d) PASTE(PASTE(a,b),PASTE(c,d))
-#define PASTE5(a,b,c,d,e) PASTE(PASTE4(a,b,c,d),2)
+#define PASTE5(a,b,c,d,e) PASTE(PASTE4(a,b,c,d),e)
 
 #if defined DECIMAL_TO_DECIMAL
-#define FUNCTION_NAME PASTE5(__,NAME,SRC_KIND,DEST_KIND,2)
-#else
-#define FUNCTION_NAME PASTE4(__,NAME,SRC_KIND,DEST_KIND)
+#define FUNCTION_NAME PASTE4(NAME,SRC_KIND,DEST_KIND,2)
+#else
+#define FUNCTION_NAME PASTE4(NAME,SRC_KIND,DEST_KIND,)
+#endif
+
+/* Functions will need to be prefixed with __bid_ or __dpd_ depending on 
+ * how GCC was configured. --enable-decimal-float=[bid,dpd] */
+#if __DECIMAL_BID_FORMAT__==1
+#define PREFIXED_FUNCTION_NAME  PASTE(__bid_,FUNCTION_NAME)
+#else
+#define PREFIXED_FUNCTION_NAME  PASTE(__dfp_,FUNCTION_NAME)
 #endif
 
 #if (SRC == 128 && (defined DECIMAL_TO_DECIMAL || defined DECIMAL_TO_INTEGER)) || \
@@ -279,16 +289,54 @@
       (((status) & DEC_IEEE_854_Underflow) ? FE_UNDERFLOW : 0))
 
 #include <fenv_libc.h>
-#define DFP_TEST_EXCEPTIONS(status)	({	\
+
+#ifdef fegetenv_register
+# define DFP_TEST_EXCEPTIONS(status)	({	\
 	fenv_union_t u; 			\
 	u.fenv = fegetenv_register(); 		\
 	u.l[1] & (status);			\
 	})
-#define DFP_CLEAR_EXCEPTIONS(status)	{	\
+# define DFP_CLEAR_EXCEPTIONS(status)	{	\
 	fenv_union_t u;				\
 	u.fenv = fegetenv_register();		\
 	u.l[1] &= ~status;			\
 	fesetenv_register(u.fenv);		\
 	}
+#else
+/* Non-register targets might want to use the standard functions.
+ * Note that it is necessary to include these symbols in libdfp
+ * to avoid libm dependencies.  */
+# define DFP_TEST_EXCEPTIONS(status)	fetestexcept (status)
+# define DFP_CLEAR_EXCEPTIONS(status)	feclearexcept (status)
+#endif
+
 #define DFP_HANDLE_EXCEPTIONS(status)	feraiseexcept(status)
 
+
+
+
+
+
+#define CONVERT_WRAPPER(...)			\
+DEST_TYPE					\
+PREFIXED_FUNCTION_NAME (SRC_TYPE a)		\
+{						\
+	DEST_TYPE result = DEST_LITERAL(0.);	\
+						\
+	switch (CLASSIFY (a)) {			\
+		case FP_ZERO:			\
+			result = SIGNBIT(a) ? DEST_LITERAL(-0.) : DEST_LITERAL(0.);	\
+			break;			\
+		case FP_INFINITE: 		\
+			result = SIGNBIT(a) ? -DEST_INFINITY : DEST_INFINITY;	\
+			break;			\
+		case FP_NAN:			\
+			result = DEST_NAN;	\
+			break;			\
+		default: {			\
+			__VA_ARGS__		\
+			}			\
+	}					\
+	return result;				\
+}
+			

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/divdd3.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/divdd3.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/divdd3.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal64 division for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -21,7 +21,7 @@
 
 
 #define _DECIMAL_SIZE 64
-#define ACTUAL_FUNCTION_NAME __divdd3
+#define ACTUAL_FUNCTION_NAME divdd3
 #include <decimal64.h>
 
 #include "divsd3.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/divsd3.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/divsd3.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/divsd3.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal32 division for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -23,7 +23,7 @@
 #ifndef _DECIMAL_SIZE
 #  include <decimal32.h>
 #  define _DECIMAL_SIZE 32
-#  define ACTUAL_FUNCTION_NAME __divsd3
+#  define ACTUAL_FUNCTION_NAME divsd3
 #endif
 
 #include <decContext.h>
@@ -34,7 +34,7 @@
 
 #include <dfpmacro.h>
 DEC_TYPE
-ACTUAL_FUNCTION_NAME (DEC_TYPE x, DEC_TYPE y)
+PREFIXED_FUNCTION_NAME (DEC_TYPE x, DEC_TYPE y)
 {
   DEC_TYPE result;
   decNumber dn_x, dn_y, dn_result;

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/divtd3.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/divtd3.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/divtd3.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal128 division for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -21,7 +21,7 @@
 
 
 #define _DECIMAL_SIZE 128
-#define ACTUAL_FUNCTION_NAME __divtd3
+#define ACTUAL_FUNCTION_NAME divtd3
 #include <decimal128.h>
 
 #include "divsd3.c"

Added: branches/libdfp/libc/dfp/sysdeps/soft-dfp/dpd/Versions
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/dpd/Versions (added)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/dpd/Versions Fri Sep 19 16:23:12 2008
@@ -1,0 +1,31 @@
+libdfp {
+  GLIBC_2.7 {
+    __dpd_addsd3; __dpd_adddd3; __dpd_addtd3;
+    __dpd_subsd3; __dpd_subdd3; __dpd_subtd3;
+    __dpd_mulsd3; __dpd_muldd3; __dpd_multd3;
+    __dpd_divsd3; __dpd_divdd3; __dpd_divtd3;
+    __dpd_eqsd2; __dpd_eqdd2; __dpd_eqtd2;
+    __dpd_nesd2; __dpd_nedd2; __dpd_netd2;
+    __dpd_ltsd2; __dpd_ltdd2; __dpd_lttd2;
+    __dpd_gtsd2; __dpd_gtdd2; __dpd_gttd2;
+    __dpd_lesd2; __dpd_ledd2; __dpd_letd2;
+    __dpd_gesd2; __dpd_gedd2; __dpd_getd2;
+    __dpd_unordsd2; __dpd_unorddd2; __dpd_unordtd2;
+    __dpd_extendsddd2; __dpd_extendsdtd2; __dpd_extendddtd2;
+    __dpd_extendsfsd; __dpd_extendsddf; __dpd_extendsdtf;
+    __dpd_extendsfdd; __dpd_extenddfdd; __dpd_extendddtf;
+    __dpd_extendsftd; __dpd_extenddftd; __dpd_extendtftd;
+    __dpd_trunctdsd2; __dpd_truncddsd2; __dpd_trunctddd2;
+    __dpd_truncsdsf; __dpd_truncdfsd; __dpd_trunctfsd;
+    __dpd_truncddsf; __dpd_truncdddf; __dpd_trunctfdd;
+    __dpd_trunctdsf; __dpd_trunctddf; __dpd_trunctdtf;
+    __dpd_fixsdsi; __dpd_fixddsi; __dpd_fixtdsi;
+    __dpd_fixsddi; __dpd_fixdddi; __dpd_fixtddi;
+    __dpd_fixunssdsi; __dpd_fixunsddsi; __dpd_fixunstdsi;
+    __dpd_fixunssddi; __dpd_fixunsdddi; __dpd_fixunstddi;
+    __dpd_floatsisd; __dpd_floatsidd; __dpd_floatsitd;
+    __dpd_floatdisd; __dpd_floatdidd; __dpd_floatditd;
+    __dpd_floatunssisd; __dpd_floatunssidd; __dpd_floatunssitd;
+    __dpd_floatunsdisd; __dpd_floatunsdidd; __dpd_floatunsditd;
+  }
+}

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/eqdd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/eqdd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/eqdd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal64 compare equality for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -21,7 +21,7 @@
 
 
 #define _DECIMAL_SIZE 64
-#define ACTUAL_FUNCTION_NAME __eqdd2
+#define ACTUAL_FUNCTION_NAME eqdd2
 #include <decimal64.h>
 
 #include "eqsd2.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/eqsd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/eqsd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/eqsd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal32 compare equality for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -23,7 +23,7 @@
 #ifndef _DECIMAL_SIZE
 #  include <decimal32.h>
 #  define _DECIMAL_SIZE 32
-#  define ACTUAL_FUNCTION_NAME __eqsd2
+#  define ACTUAL_FUNCTION_NAME eqsd2
 #endif
 
 #include <decContext.h>
@@ -34,7 +34,7 @@
 
 #include <dfpmacro.h>
 int
-ACTUAL_FUNCTION_NAME (DEC_TYPE x, DEC_TYPE y)
+PREFIXED_FUNCTION_NAME (DEC_TYPE x, DEC_TYPE y)
 {
   decNumber dn_x, dn_y, result;
   decContext context;

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/eqtd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/eqtd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/eqtd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal128 compare equality for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -21,7 +21,7 @@
 
 
 #define _DECIMAL_SIZE 128
-#define ACTUAL_FUNCTION_NAME __eqtd2
+#define ACTUAL_FUNCTION_NAME eqtd2
 #include <decimal128.h>
 
 #include "eqsd2.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendddtd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendddtd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendddtd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal64 to Decimal128
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -25,4 +25,4 @@
 #define DEST 128
 #define NAME extend
 
-#include "convert.c"
+#include "extendsddd2.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendddtf.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendddtf.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendddtf.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal64 to binary long double (128)
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -19,10 +19,32 @@
 
    Please see dfp/COPYING.txt for more information.  */
 
-
+#ifndef DECIMAL_TO_BINARY
 #define DECIMAL_TO_BINARY
 #define SRC 64
 #define DEST 128
 #define NAME extend
 
-#include "convert.c"
+extern double __truncdddf (_Decimal64);
+extern _Decimal64 __extenddfdd (double);
+
+#endif
+
+#include "convert.h"
+
+CONVERT_WRAPPER(
+// extendddtf, trunctdtf
+	double df_part1, df_part2;
+	SRC_TYPE dd_part1, dd_part2;
+
+	df_part1 = a;			/* TD -> DF  */
+	dd_part1 = df_part1;		/* DF -> DD./TD.  */
+	dd_part2 = a - dd_part1;	/* DD./TD.  */
+	df_part2 = dd_part2;		/* DD/TD -> DF.  */
+	result = df_part1;
+	result += df_part2;
+	/* Clear inexact exception raised by DFP arithmetic.  */
+	if (DFP_EXCEPTIONS_ENABLED
+	    && DFP_TEST_EXCEPTIONS (FE_OVERFLOW|FE_UNDERFLOW) == 0)
+	  DFP_CLEAR_EXCEPTIONS (FE_INEXACT);
+)

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/extenddfdd.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/extenddfdd.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/extenddfdd.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from binary double (64) to Decimal64
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -25,4 +25,4 @@
 #define DEST 64
 #define NAME extend
 
-#include "convert.c"
+#include "truncdfsd.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/extenddftd.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/extenddftd.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/extenddftd.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from binary double (64) to Decimal128
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -25,4 +25,4 @@
 #define DEST 128
 #define NAME extend
 
-#include "convert.c"
+#include "truncdfsd.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsddd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsddd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsddd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal32 to Decimal64
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -20,9 +20,38 @@
    Please see dfp/COPYING.txt for more information.  */
 
 
+#ifndef DECIMAL_TO_DECIMAL
 #define DECIMAL_TO_DECIMAL
 #define SRC 32
 #define DEST 64
 #define NAME extend
+#endif
 
-#include "convert.c"
+#include "convert.h"
+
+DEST_TYPE
+PREFIXED_FUNCTION_NAME (SRC_TYPE a)
+{
+	DEST_TYPE result;
+	decNumber d;
+	decContext context;
+	IEEE_SRC_TYPE e;
+	IEEE_DEST_TYPE r;
+	
+	___decContextDefault(&context, CONTEXT_INIT);
+	context.round = __dn_getround();
+	
+	PASTE(___host_to_ieee_,SRC) ((&a), &e);
+	PASTE(___decimal,PASTE(SRC,ToNumber))(&e, &d);
+	/* PASTE(___decimal,PASTE(SRC,ToNumber))(&a, &d); */
+	/* PASTE(___decimal,PASTE(DEST,FromNumber))(&result, &d, &context);  */
+	PASTE(___decimal,PASTE(DEST,FromNumber))(&r, &d, &context);
+	PASTE(PASTE(___ieee_,DEST),_to_host) (&r, (&result));
+
+	if (context.status != 0) {
+	  int dec_flags = context.status & (DEC_IEEE_854_Inexact|DEC_IEEE_854_Invalid_operation);
+	  DFP_HANDLE_EXCEPTIONS(DFP_IEEE_FLAGS(dec_flags));
+	}
+
+	return result;
+}

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsddf.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsddf.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsddf.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal32 to binary double (64)
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -25,4 +25,4 @@
 #define DEST 64
 #define NAME extend
 
-#include "convert.c"
+#include "truncsdsf.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsdtd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsdtd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsdtd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal32 to Decimal128
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -25,4 +25,4 @@
 #define DEST 128
 #define NAME extend
 
-#include "convert.c"
+#include "extendsddd2.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsdtf.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsdtf.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsdtf.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal32 to binary long double (128)
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -20,9 +20,27 @@
    Please see dfp/COPYING.txt for more information.  */
 
 
+#ifndef DECIMAL_TO_BINARY
 #define DECIMAL_TO_BINARY
 #define SRC 32
 #define DEST 128
 #define NAME extend
 
-#include "convert.c"
+extern double __extendsddf (_Decimal32);
+extern _Decimal32 __truncdfsd (double);
+
+#endif
+
+#include "convert.h"
+
+CONVERT_WRAPPER(
+	double df_part1, df_part2;
+	_Decimal32 sd_part1, sd_part2;
+
+	df_part1 = a;			/* TD -> DF  */
+	sd_part1 = df_part1;		/* DF -> SD (not exact) */
+	sd_part2 = a - sd_part1;	/* SD */
+	df_part2 = sd_part2;		/* SD -> DF (trunc) */
+	result = df_part1;
+	result += df_part2;
+)

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsfdd.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsfdd.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsfdd.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from binary float (32) to Decimal64
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -25,4 +25,4 @@
 #define DEST 64
 #define NAME extend
 
-#include "convert.c"
+#include "extendsfsd.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsfsd.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsfsd.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsfsd.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from binary float (32) to Decimal32
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -20,9 +20,39 @@
    Please see dfp/COPYING.txt for more information.  */
 
 
+#ifndef BINARY_TO_DECIMAL
 #define BINARY_TO_DECIMAL
 #define SRC 32
 #define DEST 32
 #define NAME extend
+#endif
 
-#include "convert.c"
+#include "convert.h"
+
+#if DEST==32
+#define TEMP_TYPE	_Decimal64
+#else
+#define TEMP_TYPE	_Decimal128
+#endif
+
+CONVERT_WRAPPER(
+// extendsfsd, extendsfdd, extendsftd
+	TEMP_TYPE temp;
+	float a_norm;
+	long long mant;
+	int exp, sexp;
+
+	a_norm = FREXPSF (a, &exp);
+	mant = a_norm * 16777216.0;	/* 24 bits of mantissa.  */
+	sexp = exp - 24;		/* Exponent adjusted for mantissa.  */
+	temp = mant;
+	if (sexp > 0)
+		temp *= DECPOWOF2[sexp];
+	else if (sexp < 0)
+		temp /= DECPOWOF2[-sexp];
+	result = temp;
+	/* Clear inexact exception raised by DFP arithmetic.  */
+	if (DFP_EXCEPTIONS_ENABLED
+	    && DFP_TEST_EXCEPTIONS (FE_OVERFLOW|FE_UNDERFLOW) == 0)
+	  DFP_CLEAR_EXCEPTIONS (FE_INEXACT);
+)

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsftd.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsftd.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendsftd.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from binary float (32) to Decimal128
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -25,4 +25,4 @@
 #define DEST 128
 #define NAME extend
 
-#include "convert.c"
+#include "extendsfsd.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendtftd.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendtftd.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/extendtftd.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from binary long double (dual 64bit) to Decimal128
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -25,4 +25,6 @@
 #define DEST 128
 #define NAME extend
 
-#include "convert.c"
+extern _Decimal128	__extenddftd(double);
+
+#include "trunctfsd.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixdddi.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixdddi.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixdddi.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal64 to binary long (64)
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -19,10 +19,11 @@
 
    Please see dfp/COPYING.txt for more information.  */
 
-
 #define DECIMAL_TO_INTEGER
 #define SRC 64
 #define DEST 64
 #define NAME fix
 
-#include "convert.c"
+#include "fixsdsi.c"
+
+

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixddsi.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixddsi.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixddsi.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal64 to binary integer (32)
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -25,4 +25,4 @@
 #define DEST 32
 #define NAME fix
 
-#include "convert.c"
+#include "fixsdsi.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixsddi.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixsddi.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixsddi.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal32 to binary long (64)
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -25,4 +25,4 @@
 #define DEST 64
 #define NAME fix
 
-#include "convert.c"
+#include "fixsdsi.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixsdsi.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixsdsi.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixsdsi.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal32 to binary integer (32)
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -19,10 +19,55 @@
 
    Please see dfp/COPYING.txt for more information.  */
 
-
+#ifndef DECIMAL_TO_INTEGER
 #define DECIMAL_TO_INTEGER
 #define SRC 32
 #define DEST 32
 #define NAME fix
+#endif
 
-#include "convert.c"
+#include "convert.h"
+#include <string.h>
+#include <stdlib.h>
+
+#define BUFMAX 128
+
+DEST_TYPE
+PREFIXED_FUNCTION_NAME (SRC_TYPE a)
+{
+  /* decNumber's decimal* types have the same format as C's _Decimal*
+     types, but they have different calling conventions.  */
+
+  /* TODO: Decimal float to integer conversions should raise FE_INVALID
+     if the result value does not fit into the result type.  */
+
+  char buf[BUFMAX];
+  char *pos;
+  decNumber qval, n1, n2;
+  decContext context;
+  IEEE_SRC_TYPE e;
+
+  /* Use a large context to avoid losing precision.  */
+  ___decContextDefault (&context, DEC_INIT_DECIMAL128);
+  /* Need non-default rounding mode here.  */
+  context.round = DEC_ROUND_DOWN;
+
+  PASTE(___host_to_ieee_,SRC) ((&a), &e);
+  PASTE(___decimal,PASTE(SRC,ToNumber))(&e, &n1);
+  /* PASTE(___decimal,PASTE(SRC,ToNumber))(&a, &n1); */
+
+  /* Rescale if the exponent is less than zero.  */
+  ___decNumberToIntegralValue (&n2, &n1, &context);
+  /* Get a value to use for the quantize call.  */
+  ___decNumberFromString (&qval, (char *) "1.0", &context);
+  /* Force the exponent to zero.  */
+  ___decNumberQuantize (&n1, &n2, &qval, &context);
+  /* Get a string, which at this point will not include an exponent.  */
+  ___decNumberToString (&n1, buf);
+  /* Ignore the fractional part.  */
+  pos = strchr (buf, '.');
+  if (pos)
+    *pos = 0;
+  /* Use a C library function to convert to the integral type.  */
+  return STR_TO_INT (buf, NULL, 10);
+}

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixtddi.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixtddi.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixtddi.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal64 to binary long (64)
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -25,4 +25,4 @@
 #define DEST 64
 #define NAME fix
 
-#include "convert.c"
+#include "fixsdsi.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixtdsi.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixtdsi.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixtdsi.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal64 to binary integer (32)
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -25,4 +25,4 @@
 #define DEST 32
 #define NAME fix
 
-#include "convert.c"
+#include "fixsdsi.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixunsdddi.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixunsdddi.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixunsdddi.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal64 to binary unsigned long (64)
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -26,4 +26,4 @@
 #define NAME fixuns
 #define UNSIGNED
 
-#include "convert.c"
+#include "fixsdsi.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixunsddsi.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixunsddsi.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixunsddsi.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal64 to binary unsigned integer (32)
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -26,4 +26,4 @@
 #define NAME fixuns
 #define UNSIGNED
 
-#include "convert.c"
+#include "fixsdsi.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixunssddi.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixunssddi.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixunssddi.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal32 to binary unsigned long (64)
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -26,4 +26,4 @@
 #define NAME fixuns
 #define UNSIGNED
 
-#include "convert.c"
+#include "fixsdsi.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixunssdsi.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixunssdsi.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixunssdsi.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal32 to binary unsigned integer (32)
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -26,4 +26,4 @@
 #define NAME fixuns
 #define UNSIGNED
 
-#include "convert.c"
+#include "fixsdsi.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixunstddi.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixunstddi.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixunstddi.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal64 to binary unsigned long (64)
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -26,4 +26,4 @@
 #define NAME fixuns
 #define UNSIGNED
 
-#include "convert.c"
+#include "fixsdsi.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixunstdsi.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixunstdsi.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/fixunstdsi.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal64 to binary unsigned integer (32)
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -26,4 +26,4 @@
 #define NAME fixuns
 #define UNSIGNED
 
-#include "convert.c"
+#include "fixsdsi.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatdidd.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatdidd.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatdidd.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from binary long (64) to Decimal64
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -25,4 +25,4 @@
 #define DEST 64
 #define NAME float
 
-#include "convert.c"
+#include "floatsisd.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatdisd.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatdisd.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatdisd.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from binary long (64) to Decimal32
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -25,4 +25,4 @@
 #define DEST 32
 #define NAME float
 
-#include "convert.c"
+#include "floatsisd.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatditd.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatditd.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatditd.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from binary long (64) to Decimal128
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -25,4 +25,4 @@
 #define DEST 128
 #define NAME float
 
-#include "convert.c"
+#include "floatsisd.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatsidd.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatsidd.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatsidd.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from binary integer (32) to Decimal64
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -25,4 +25,4 @@
 #define DEST 64
 #define NAME float
 
-#include "convert.c"
+#include "floatsisd.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatsisd.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatsisd.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatsisd.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from binary integer (32) to Decimal32
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -19,10 +19,41 @@
 
    Please see dfp/COPYING.txt for more information.  */
 
-
+#ifndef INTEGER_TO_DECIMAL
 #define INTEGER_TO_DECIMAL
 #define SRC 32
 #define DEST 32
 #define NAME float
+#endif
 
-#include "convert.c"
+#include "convert.h"
+#include <stdio.h>
+
+#define BUFMAX 128
+
+DEST_TYPE
+PREFIXED_FUNCTION_NAME (SRC_TYPE a)
+{
+  DEST_TYPE f;
+  char buf[BUFMAX];
+  decContext context;
+  IEEE_DEST_TYPE e;
+
+        ___decContextDefault (&context, CONTEXT_INIT);
+        context.round = DEC_ROUND_HALF_EVEN;
+
+  /* Use a C library function to get a floating point string.  */
+  sprintf (buf, INT_FMT ".0", CAST_FOR_FMT(a));
+  /* Convert from the floating point string to a decimal* type.  */
+  /* PASTE(___decimal,PASTE(DEST,FromString))(&f, buf, &context);  */
+  PASTE(___decimal,PASTE(DEST,FromString))(&e, buf, &context);
+  PASTE(PASTE(___ieee_,DEST),_to_host) (&e, (&f));
+
+        if (context.status != 0) {
+          int dec_flags = context.status & 
+            (DEC_IEEE_854_Inexact|DEC_IEEE_854_Invalid_operation|DEC_IEEE_854_Overflow);
+          DFP_HANDLE_EXCEPTIONS(DFP_IEEE_FLAGS(dec_flags));
+        }
+
+  return f;
+}

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatsitd.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatsitd.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatsitd.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from binary integer (32) to Decimal128
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -25,4 +25,4 @@
 #define DEST 128
 #define NAME float
 
-#include "convert.c"
+#include "floatsisd.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatunsdidd.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatunsdidd.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatunsdidd.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from binary unsigned long (64) to Decimal64
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -26,4 +26,4 @@
 #define NAME floatuns
 #define UNSIGNED
 
-#include "convert.c"
+#include "floatsisd.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatunsdisd.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatunsdisd.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatunsdisd.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from binary unsigned long (64) to Decimal32
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -26,4 +26,4 @@
 #define NAME floatuns
 #define UNSIGNED
 
-#include "convert.c"
+#include "floatsisd.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatunsditd.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatunsditd.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatunsditd.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from binary unsigned long (64) to Decimal128
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -26,4 +26,4 @@
 #define NAME floatuns
 #define UNSIGNED
 
-#include "convert.c"
+#include "floatsisd.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatunssidd.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatunssidd.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatunssidd.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from binary unsigned integer (32) to Decimal64
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -26,4 +26,4 @@
 #define NAME floatuns
 #define UNSIGNED
 
-#include "convert.c"
+#include "floatsisd.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatunssisd.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatunssisd.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatunssisd.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from binary unsigned integer (32) to Decimal32
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -26,4 +26,4 @@
 #define NAME floatuns
 #define UNSIGNED
 
-#include "convert.c"
+#include "floatsisd.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatunssitd.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatunssitd.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/floatunssitd.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from binary unsigned integer (32) to Decimal128
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -26,4 +26,4 @@
 #define NAME floatuns
 #define UNSIGNED
 
-#include "convert.c"
+#include "floatsisd.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/gedd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/gedd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/gedd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal64 compare greather-than or equal for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -21,7 +21,7 @@
 
 
 #define _DECIMAL_SIZE 64
-#define ACTUAL_FUNCTION_NAME __gedd2
+#define ACTUAL_FUNCTION_NAME gedd2
 #include <decimal64.h>
 
 #include "gesd2.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/gesd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/gesd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/gesd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal32 compare greather-than or equal for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -23,7 +23,7 @@
 #ifndef _DECIMAL_SIZE
 #  include <decimal32.h>
 #  define _DECIMAL_SIZE 32
-#  define ACTUAL_FUNCTION_NAME __gesd2
+#  define ACTUAL_FUNCTION_NAME gesd2
 #endif
 
 #include <decContext.h>
@@ -34,7 +34,7 @@
 
 #include <dfpmacro.h>
 int
-ACTUAL_FUNCTION_NAME (DEC_TYPE x, DEC_TYPE y)
+PREFIXED_FUNCTION_NAME (DEC_TYPE x, DEC_TYPE y)
 {
   decNumber dn_x, dn_y, result;
   decContext context;

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/getd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/getd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/getd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal128 compare greather-than or equal for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -21,7 +21,7 @@
 
 
 #define _DECIMAL_SIZE 128
-#define ACTUAL_FUNCTION_NAME __getd2
+#define ACTUAL_FUNCTION_NAME getd2
 #include <decimal128.h>
 
 #include "gesd2.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/gtdd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/gtdd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/gtdd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal64 compare greater-than for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -21,7 +21,7 @@
 
 
 #define _DECIMAL_SIZE 64
-#define ACTUAL_FUNCTION_NAME __gtdd2
+#define ACTUAL_FUNCTION_NAME gtdd2
 #include <decimal64.h>
 
 #include "gtsd2.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/gtsd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/gtsd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/gtsd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal32 compare greater-than for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -23,7 +23,7 @@
 #ifndef _DECIMAL_SIZE
 #  include <decimal32.h>
 #  define _DECIMAL_SIZE 32
-#  define ACTUAL_FUNCTION_NAME __gtsd2
+#  define ACTUAL_FUNCTION_NAME gtsd2
 #endif
 
 #include <decContext.h>
@@ -34,7 +34,7 @@
 
 #include <dfpmacro.h>
 int
-ACTUAL_FUNCTION_NAME (DEC_TYPE x, DEC_TYPE y)
+PREFIXED_FUNCTION_NAME (DEC_TYPE x, DEC_TYPE y)
 {
   decNumber dn_x, dn_y, result;
   decContext context;

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/gttd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/gttd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/gttd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal128 compare greater-than for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -21,7 +21,7 @@
 
 
 #define _DECIMAL_SIZE 128
-#define ACTUAL_FUNCTION_NAME __gttd2
+#define ACTUAL_FUNCTION_NAME gttd2
 #include <decimal128.h>
 
 #include "gtsd2.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/ledd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/ledd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/ledd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal64 compare less-than or equal for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -21,7 +21,7 @@
 
 
 #define _DECIMAL_SIZE 64
-#define ACTUAL_FUNCTION_NAME __ledd2
+#define ACTUAL_FUNCTION_NAME ledd2
 #include <decimal64.h>
 
 #include "lesd2.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/lesd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/lesd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/lesd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal32 compare less-than or equal for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -23,7 +23,7 @@
 #ifndef _DECIMAL_SIZE
 #  include <decimal32.h>
 #  define _DECIMAL_SIZE 32
-#  define ACTUAL_FUNCTION_NAME __lesd2
+#  define ACTUAL_FUNCTION_NAME lesd2
 #endif
 
 #include <decContext.h>
@@ -34,7 +34,7 @@
 
 #include <dfpmacro.h>
 int
-ACTUAL_FUNCTION_NAME (DEC_TYPE x, DEC_TYPE y)
+PREFIXED_FUNCTION_NAME (DEC_TYPE x, DEC_TYPE y)
 {
   decNumber dn_x, dn_y, result;
   decContext context;

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/letd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/letd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/letd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal128 compare less-than or equal for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -21,7 +21,7 @@
 
 
 #define _DECIMAL_SIZE 128
-#define ACTUAL_FUNCTION_NAME __letd2
+#define ACTUAL_FUNCTION_NAME letd2
 #include <decimal128.h>
 
 #include "lesd2.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/ltdd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/ltdd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/ltdd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal64 compare less-than for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -21,7 +21,7 @@
 
 
 #define _DECIMAL_SIZE 64
-#define ACTUAL_FUNCTION_NAME __ltdd2
+#define ACTUAL_FUNCTION_NAME ltdd2
 #include <decimal64.h>
 
 #include "ltsd2.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/ltsd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/ltsd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/ltsd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal32 compare less-than for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -23,7 +23,7 @@
 #ifndef _DECIMAL_SIZE
 #  include <decimal32.h>
 #  define _DECIMAL_SIZE 32
-#  define ACTUAL_FUNCTION_NAME __ltsd2
+#  define ACTUAL_FUNCTION_NAME ltsd2
 #endif
 
 #include <decContext.h>
@@ -34,7 +34,7 @@
 
 #include <dfpmacro.h>
 int
-ACTUAL_FUNCTION_NAME (DEC_TYPE x, DEC_TYPE y)
+PREFIXED_FUNCTION_NAME (DEC_TYPE x, DEC_TYPE y)
 {
   decNumber dn_x, dn_y, result;
   decContext context;

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/lttd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/lttd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/lttd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal128 compare less-than for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -21,7 +21,7 @@
 
 
 #define _DECIMAL_SIZE 128
-#define ACTUAL_FUNCTION_NAME __lttd2
+#define ACTUAL_FUNCTION_NAME lttd2
 #include <decimal128.h>
 
 #include "ltsd2.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/muldd3.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/muldd3.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/muldd3.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal64 multiplication for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -21,7 +21,7 @@
 
 
 #define _DECIMAL_SIZE 64
-#define ACTUAL_FUNCTION_NAME __muldd3
+#define ACTUAL_FUNCTION_NAME muldd3
 #include <decimal64.h>
 
 #include "mulsd3.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/mulsd3.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/mulsd3.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/mulsd3.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal32 multiplication for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -23,7 +23,7 @@
 #ifndef _DECIMAL_SIZE
 #  include <decimal32.h>
 #  define _DECIMAL_SIZE 32
-#  define ACTUAL_FUNCTION_NAME __mulsd3
+#  define ACTUAL_FUNCTION_NAME mulsd3
 #endif
 
 #include <decContext.h>
@@ -34,7 +34,7 @@
 
 #include <dfpmacro.h>
 DEC_TYPE
-ACTUAL_FUNCTION_NAME (DEC_TYPE x, DEC_TYPE y)
+PREFIXED_FUNCTION_NAME (DEC_TYPE x, DEC_TYPE y)
 {
   DEC_TYPE result;
   decNumber dn_x, dn_y, dn_result;

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/multd3.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/multd3.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/multd3.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal128 multiplication for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -21,7 +21,7 @@
 
 
 #define _DECIMAL_SIZE 128
-#define ACTUAL_FUNCTION_NAME __multd3
+#define ACTUAL_FUNCTION_NAME multd3
 #include <decimal128.h>
 
 #include "mulsd3.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/nedd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/nedd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/nedd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal64 compare inequality for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -21,7 +21,7 @@
 
 
 #define _DECIMAL_SIZE 64
-#define ACTUAL_FUNCTION_NAME __nedd2
+#define ACTUAL_FUNCTION_NAME nedd2
 #include <decimal64.h>
 
 #include "nesd2.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/nesd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/nesd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/nesd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal32 compare inequality for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -23,7 +23,7 @@
 #ifndef _DECIMAL_SIZE
 #  include <decimal32.h>
 #  define _DECIMAL_SIZE 32
-#  define ACTUAL_FUNCTION_NAME __nesd2
+#  define ACTUAL_FUNCTION_NAME nesd2
 #endif
 
 #include <decContext.h>
@@ -34,7 +34,7 @@
 
 #include <dfpmacro.h>
 int
-ACTUAL_FUNCTION_NAME (DEC_TYPE x, DEC_TYPE y)
+PREFIXED_FUNCTION_NAME (DEC_TYPE x, DEC_TYPE y)
 {
   decNumber dn_x, dn_y, result;
   decContext context;

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/netd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/netd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/netd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal128 compare inequality for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -21,7 +21,7 @@
 
 
 #define _DECIMAL_SIZE 128
-#define ACTUAL_FUNCTION_NAME __netd2
+#define ACTUAL_FUNCTION_NAME netd2
 #include <decimal128.h>
 
 #include "nesd2.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/subdd3.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/subdd3.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/subdd3.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal64 subtraction for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -21,7 +21,7 @@
 
 
 #define _DECIMAL_SIZE 64
-#define ACTUAL_FUNCTION_NAME __subdd3
+#define ACTUAL_FUNCTION_NAME subdd3
 #include <decimal64.h>
 
 #include "subsd3.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/subsd3.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/subsd3.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/subsd3.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal32 subtraction for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -23,7 +23,7 @@
 #ifndef _DECIMAL_SIZE
 #  include <decimal32.h>
 #  define _DECIMAL_SIZE 32
-#  define ACTUAL_FUNCTION_NAME __subsd3
+#  define ACTUAL_FUNCTION_NAME subsd3
 #endif
 
 #include <decContext.h>
@@ -34,7 +34,7 @@
 
 #include <dfpmacro.h>
 DEC_TYPE
-ACTUAL_FUNCTION_NAME (DEC_TYPE x, DEC_TYPE y)
+PREFIXED_FUNCTION_NAME (DEC_TYPE x, DEC_TYPE y)
 {
   DEC_TYPE result;
   decNumber dn_x, dn_y, dn_result;

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/subtd3.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/subtd3.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/subtd3.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal128 subtraction for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -21,7 +21,7 @@
 
 
 #define _DECIMAL_SIZE 128
-#define ACTUAL_FUNCTION_NAME __subtd3
+#define ACTUAL_FUNCTION_NAME subtd3
 #include <decimal128.h>
 
 #include "subsd3.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/truncdddf.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/truncdddf.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/truncdddf.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal64 to binary double (64)
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -25,4 +25,52 @@
 #define DEST 64
 #define NAME trunc
 
-#include "convert.c"
+#include "convert.h"
+
+CONVERT_WRAPPER(
+// truncdddf
+	long double temp;
+	SRC_TYPE a_norm;
+	long long mant;
+	int	exp, sexp;
+
+	a_norm = FREXPD64 (a, &exp);
+
+	/* Avoid going beyond the bounds of the table, which would also
+	   mean an overflow or underflow.  */
+	if (exp > BINPOWOF10_LIMIT)		/* Obvious overflow.  */
+	  {
+	    if (DFP_EXCEPTIONS_ENABLED)
+	      DFP_HANDLE_EXCEPTIONS (FE_OVERFLOW|FE_INEXACT);
+	    return SIGNBIT(a) ? -INFINITY : INFINITY;
+	  }
+	else if (exp < -BINPOWOF10_LIMIT)	/* Obvious underflow.  */
+	  {
+	    if (DFP_EXCEPTIONS_ENABLED)
+	      DFP_HANDLE_EXCEPTIONS (FE_UNDERFLOW|FE_INEXACT);
+	    return SIGNBIT(a) ? -0.0 : 0.0;
+	  }
+
+	mant = a_norm * 1.E+16DD;	/* 16 digits of mantissa.  */
+	sexp = exp - 16;		/* Exponent adjusted for mantissa.  */
+	temp = mant;			/* mantissa as TF */
+	if (sexp > 0)
+	  result = temp * BINPOWOF10[sexp];
+	else if (sexp < 0)
+	  {
+	    /* Avoid going beyond the bounds of the exponent table for
+	       negative exponents.  */
+	    if (sexp < -BINPOWOF10_LIMIT)
+	      {
+	        temp /= BINPOWOF10[BINPOWOF10_LIMIT];
+	        sexp += BINPOWOF10_LIMIT;
+	      }
+	    result = temp / BINPOWOF10[-sexp];
+	  }
+	else
+	  result = temp;
+	/* Clear inexact exception raised by DFP arithmetic.  */
+	if (DFP_EXCEPTIONS_ENABLED
+	    && DFP_TEST_EXCEPTIONS (FE_OVERFLOW|FE_UNDERFLOW) == 0)
+	  DFP_CLEAR_EXCEPTIONS (FE_INEXACT);
+)

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/truncddsd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/truncddsd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/truncddsd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal64 to Decimal32
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -25,4 +25,4 @@
 #define DEST 32
 #define NAME trunc
 
-#include "convert.c"
+#include "extendsddd2.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/truncddsf.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/truncddsf.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/truncddsf.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal64 to binary float (32)
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -25,4 +25,38 @@
 #define DEST 32
 #define NAME trunc
 
-#include "convert.c"
+#include "convert.h"
+
+CONVERT_WRAPPER(
+// truncddsf
+	double temp;
+	_Decimal64 a_norm;
+	long long mant;
+	int exp, sexp;
+	
+	a_norm = FREXPD64 (a, &exp);
+	
+	/* Check for values that would overflow the exponent table, which
+	   would be obvious overflow and underflow.  */
+	if (exp > 39)		/* Obvious overflow.  */
+	  {
+	    if (DFP_EXCEPTIONS_ENABLED)
+	      DFP_HANDLE_EXCEPTIONS (FE_OVERFLOW|FE_INEXACT);
+	    return SIGNBIT(a) ? -INFINITY : INFINITY;
+	  }
+	else if (exp < -39)	/* Obvious underflow.  */
+	  {
+	    if (DFP_EXCEPTIONS_ENABLED)
+	      DFP_HANDLE_EXCEPTIONS (FE_UNDERFLOW|FE_INEXACT);
+	    return SIGNBIT(a) ? -0.0 : 0.0;
+	  }
+
+	mant = a_norm * 1.E+16DD;	/* 16 digits of mantissa.  */
+	sexp = exp - 16;		/* Exponent adjusted for mantissa.  */
+	temp = mant;
+	if (sexp > 0)
+	  temp *= BINPOWOF10[sexp];
+	else if (sexp < 0)
+	  temp /= BINPOWOF10[-sexp];
+	result = temp;
+)

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/truncdfsd.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/truncdfsd.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/truncdfsd.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from binary double (64) to Decimal32
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -20,9 +20,34 @@
    Please see dfp/COPYING.txt for more information.  */
 
 
+
+#ifndef BINARY_TO_DECIMAL
 #define BINARY_TO_DECIMAL
 #define SRC 64
 #define DEST 32
 #define NAME trunc
+#endif
 
-#include "convert.c"
+#include "convert.h"
+
+CONVERT_WRAPPER(
+// truncdfsd, extenddfdd, extenddftd
+	_Decimal128 temp; /* Needs to be big enough so that temp = mant doesn't round.  */
+	double a_norm;
+	long long mant;
+	int exp, sexp;
+
+	a_norm = FREXPDF (a, &exp);
+	mant = a_norm * 9007199254740992.0;	/* 53 bits of mantissa.  */
+	sexp = exp - 53;			/* Exponent adjusted for mantissa.  */
+	temp = mant;				/* DI -> TD.  */
+	if (sexp > 0)
+		temp *= DECPOWOF2[sexp];
+	else if (sexp < 0)
+		temp /= DECPOWOF2[-sexp];
+	result = (DEST_TYPE)temp; /* Cast to the resultant type.  */
+	/* Clear inexact exception raised by DFP arithmetic.  */
+	if (DFP_EXCEPTIONS_ENABLED
+	    && DFP_TEST_EXCEPTIONS (FE_OVERFLOW|FE_UNDERFLOW) == 0)
+	  DFP_CLEAR_EXCEPTIONS (FE_INEXACT);
+)

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/truncsdsf.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/truncsdsf.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/truncsdsf.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal32 to binary float (32)
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -20,9 +20,29 @@
    Please see dfp/COPYING.txt for more information.  */
 
 
+#ifndef DECIMAL_TO_BINARY
 #define DECIMAL_TO_BINARY
 #define SRC 32
 #define DEST 32
 #define NAME trunc
+#endif
 
-#include "convert.c"
+#include "convert.h"
+
+CONVERT_WRAPPER(
+// truncsdsf, extendsddf
+	double temp;
+	SRC_TYPE a_norm;
+	long long mant;
+	int	exp, sexp;
+
+	a_norm = FREXPD32 (a, &exp);
+	mant = a_norm * 1E+7DF;		/* 7 digits of mantissa.  */
+	sexp = exp - 7;			/* Exponent adjusted for mantissa.  */
+	temp = mant;
+	if (sexp > 0)
+	  temp *= BINPOWOF10[sexp];
+	else if (sexp < 0)
+	  temp /= BINPOWOF10[-sexp];
+	result = temp;
+)

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctddd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctddd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctddd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal128 to Decimal64
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -25,4 +25,4 @@
 #define DEST 64
 #define NAME trunc
 
-#include "convert.c"
+#include "extendsddd2.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctddf.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctddf.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctddf.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal128 to binary double (64)
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -25,4 +25,49 @@
 #define DEST 64
 #define NAME trunc
 
-#include "convert.c"
+#include "convert.h"
+
+CONVERT_WRAPPER(
+// trunctddf
+	long double temp;	/* Need at least 16 decimal digits of accuracy.  */
+	SRC_TYPE a_norm;
+	long long mant;
+	int	exp, sexp;
+
+	a_norm = FREXPD128 (a, &exp);
+	/* Avoid going beyond the bounds of the exponent table.  */
+	if (exp > BINPOWOF10_LIMIT)		/* Obvious overflow.  */
+	  {
+	    if (DFP_EXCEPTIONS_ENABLED)
+	      DFP_HANDLE_EXCEPTIONS (FE_OVERFLOW|FE_INEXACT);
+	    return SIGNBIT(a) ? -INFINITY : INFINITY;
+	  }
+	else if (exp < -BINPOWOF10_LIMIT)		/* Obvious underflow.  */
+	  {
+	    if (DFP_EXCEPTIONS_ENABLED)
+	      DFP_HANDLE_EXCEPTIONS (FE_UNDERFLOW|FE_INEXACT);
+	    return SIGNBIT(a) ? -0.0 : 0.0;
+	  }
+
+	mant = a_norm * 1.E+17DL;		/* 17 digits of mantissa.  */
+	sexp = exp - 17;			/* Exponent adjusted for mantissa.  */
+	temp = mant;
+	if (sexp > 0)
+	  temp *= BINPOWOF10[sexp];
+	else if (sexp < 0)
+	  {
+	    /* Avoid going beyond the bounds of the exponent table for
+	       negative exponents.  */
+	    if (sexp < -BINPOWOF10_LIMIT)
+	      {
+	        temp /= BINPOWOF10[BINPOWOF10_LIMIT];
+	        sexp += BINPOWOF10_LIMIT;
+	      }
+	    temp /= BINPOWOF10[-sexp];
+	  }
+	result = temp;
+	/* Clear inexact exception raised by DFP arithmetic.  */
+	if (DFP_EXCEPTIONS_ENABLED
+	    && DFP_TEST_EXCEPTIONS (FE_OVERFLOW|FE_UNDERFLOW) == 0)
+	  DFP_CLEAR_EXCEPTIONS (FE_INEXACT);
+)

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctdsd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctdsd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctdsd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal128 to Decimal32
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -25,4 +25,4 @@
 #define DEST 32
 #define NAME trunc
 
-#include "convert.c"
+#include "extendsddd2.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctdsf.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctdsf.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctdsf.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal128 to binary float (32)
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -25,4 +25,37 @@
 #define DEST 32
 #define NAME trunc
 
-#include "convert.c"
+#include "convert.h"
+
+CONVERT_WRAPPER(
+// trunctdsf
+	double temp;
+	SRC_TYPE a_norm;
+	long long mant;
+	int	exp, sexp;
+	
+	a_norm = FREXPD128 (a, &exp);
+	/* Handle obvious overflow and underflow to avoid going beyond the
+	   bounds of the exponent table.  */
+	if (exp > 39)		/* Obvious overflow.  */
+	  {
+	    if (DFP_EXCEPTIONS_ENABLED)
+	      DFP_HANDLE_EXCEPTIONS (FE_OVERFLOW|FE_INEXACT);
+	    return SIGNBIT(a) ? -INFINITY : INFINITY;
+	  }
+	else if (exp < -39)	/* Obvious underflow. */
+	  {
+	    if (DFP_EXCEPTIONS_ENABLED)
+	      DFP_HANDLE_EXCEPTIONS (FE_UNDERFLOW|FE_INEXACT);
+	    return SIGNBIT(a) ? -0.0 : 0.0;
+	  }
+
+	mant = a_norm * 1E+15DL;		/* 15 digits of mantissa.  */
+	sexp = exp - 15;			/* Exponent adjusted for mantissa.  */
+	temp = mant;
+	if (sexp > 0)
+	  temp *= BINPOWOF10[sexp];
+	else if (sexp < 0)
+	  temp /= BINPOWOF10[-sexp];
+        result = temp;
+)

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctdtf.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctdtf.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctdtf.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from Decimal128 to binary long double (dual 64bit)
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -25,4 +25,7 @@
 #define DEST 128
 #define NAME trunc
 
-#include "convert.c"
+extern double __trunctddf(_Decimal128);
+extern _Decimal128 __extenddftd(double);
+
+#include "extendddtf.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctfdd.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctfdd.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctfdd.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from binary long double (128) to Decimal64
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -25,4 +25,6 @@
 #define DEST 64
 #define NAME trunc
 
-#include "convert.c"
+extern _Decimal64 __extenddfdd(double);
+
+#include "trunctfsd.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctfsd.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctfsd.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/trunctfsd.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* Handle conversion from binary long double (128) to Decimal32
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -20,9 +20,33 @@
    Please see dfp/COPYING.txt for more information.  */
 
 
+#ifndef BINARY_TO_DECIMAL
 #define BINARY_TO_DECIMAL
 #define SRC 128
 #define DEST 32
 #define NAME trunc
 
-#include "convert.c"
+extern _Decimal32 __truncdfsd(double);
+
+#endif
+
+#include "convert.h"
+
+CONVERT_WRAPPER(
+// truncdfsd, extenddfdd, extenddftd
+	DEST_TYPE temp;
+	union {
+		SRC_TYPE ld;
+		double d[2];
+	} ldd;
+
+	ldd.ld = a;
+	temp = ldd.d[0];
+	result = temp;
+	temp = ldd.d[1];
+	result += temp;
+	/* Clear inexact exception raised by DFP arithmetic.  */
+	if (DFP_EXCEPTIONS_ENABLED
+	    && DFP_TEST_EXCEPTIONS (FE_OVERFLOW|FE_UNDERFLOW) == 0)
+	  DFP_CLEAR_EXCEPTIONS (FE_INEXACT);
+)

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/unorddd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/unorddd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/unorddd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal64 compare unordered for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -21,7 +21,7 @@
 
 
 #define _DECIMAL_SIZE 64
-#define ACTUAL_FUNCTION_NAME __unorddd2
+#define ACTUAL_FUNCTION_NAME unorddd2
 #include <decimal64.h>
 
 #include "unordsd2.c"

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/unordsd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/unordsd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/unordsd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal32 compare unordered for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -23,26 +23,16 @@
 #ifndef _DECIMAL_SIZE
 #  include <decimal32.h>
 #  define _DECIMAL_SIZE 32
-#  define ACTUAL_FUNCTION_NAME __unordsd2
+#  define ACTUAL_FUNCTION_NAME unordsd2
 #endif
 
-#include <decContext.h>
-#include <decNumber.h>
 #include <math.h>
 
 #define FUNCTION_NAME unord
 
 #include <dfpmacro.h>
 int
-ACTUAL_FUNCTION_NAME (DEC_TYPE x, DEC_TYPE y)
+PREFIXED_FUNCTION_NAME (DEC_TYPE x, DEC_TYPE y)
 {
-  decNumber dn_x;
-  decNumber dn_y;
-  decContext context;
-  ___decContextDefault(&context, DEFAULT_CONTEXT);
-
-  FUNC_CONVERT_TO_DN(&x, &dn_x);
-  FUNC_CONVERT_TO_DN(&y, &dn_y);
-
-  return (___decNumberIsNaN(&dn_x) || ___decNumberIsNaN(&dn_y));
+  return FUNC_D(__isnan) (x) || FUNC_D(__isnan) (y);
 }

Modified: branches/libdfp/libc/dfp/sysdeps/soft-dfp/unordtd2.c
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/soft-dfp/unordtd2.c (original)
+++ branches/libdfp/libc/dfp/sysdeps/soft-dfp/unordtd2.c Fri Sep 19 16:23:12 2008
@@ -1,5 +1,5 @@
 /* _Decimal128 compare unordered for soft-dfp
-   Copyright (C) 2007 IBM Corporation.
+   Copyright (C) 2007,2008 IBM Corporation.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
 
@@ -21,7 +21,7 @@
 
 
 #define _DECIMAL_SIZE 128
-#define ACTUAL_FUNCTION_NAME __unordtd2
+#define ACTUAL_FUNCTION_NAME unordtd2
 #include <decimal128.h>
 
 #include "unordsd2.c"

Modified: branches/libdfp/libc/dfp/sysdeps/unix/sysv/linux/s390/Implies
==============================================================================
--- branches/libdfp/libc/dfp/sysdeps/unix/sysv/linux/s390/Implies (original)
+++ branches/libdfp/libc/dfp/sysdeps/unix/sysv/linux/s390/Implies Fri Sep 19 16:23:12 2008
@@ -1,1 +1,1 @@
-dfp/dpd
+soft-dfp/dpd