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

[Commits] r19820 - in /libdfp/trunk: ./ sysdeps/dpd/ sysdeps/powerpc/dfpu/ tests/



Author: ryanarn
Date: Wed Jul 25 15:27:31 2012
New Revision: 19820

Log:
2012-07-25  Ryan S. Arnold  <rsa@xxxxxxxxxxxxxxxxxx>

	* sysdeps/powerpc/dfpu/numdigits.h (numdigits*): Fix inline asm to
	place result of drrnd[q] into DEC_TYPE instead of double.  Update
	copyright years to range.
	* tests/test-decode.c: Update copyright years to range.
	* tests/test-param.c: Likewise.
	* tests/test-printf.c: Likewise.
	* tests/test-numdigits.c: Likewise.
	* tests/test-istream.cpp: Likewise.
	* tests/test-strtod.c: Likewise.
	* sysdeps/dpd/dpd-private.c: Likewise.
	* printf_dfp.c: Fix erroneous test for _Decimal64.  Update copyright
	years to range.

Modified:
    libdfp/trunk/ChangeLog
    libdfp/trunk/printf_dfp.c
    libdfp/trunk/sysdeps/dpd/dpd-private.c
    libdfp/trunk/sysdeps/powerpc/dfpu/numdigits.h
    libdfp/trunk/tests/test-decode.c
    libdfp/trunk/tests/test-istream.cpp
    libdfp/trunk/tests/test-numdigits.c
    libdfp/trunk/tests/test-param.c
    libdfp/trunk/tests/test-printf.c
    libdfp/trunk/tests/test-strtod.c

Modified: libdfp/trunk/ChangeLog
==============================================================================
--- libdfp/trunk/ChangeLog (original)
+++ libdfp/trunk/ChangeLog Wed Jul 25 15:27:31 2012
@@ -1,3 +1,18 @@
+2012-07-25  Ryan S. Arnold  <rsa@xxxxxxxxxxxxxxxxxx>
+
+	* sysdeps/powerpc/dfpu/numdigits.h (numdigits*): Fix inline asm to
+	place result of drrnd[q] into DEC_TYPE instead of double.  Update
+	copyright years to range.
+	* tests/test-decode.c: Update copyright years to range.
+	* tests/test-param.c: Likewise.
+	* tests/test-printf.c: Likewise.
+	* tests/test-numdigits.c: Likewise.
+	* tests/test-istream.cpp: Likewise.
+	* tests/test-strtod.c: Likewise.
+	* sysdeps/dpd/dpd-private.c: Likewise.
+	* printf_dfp.c: Fix erroneous test for _Decimal64.  Update copyright
+	years to range.
+
 2012-07-24  Ryan S. Arnold  <rsa@xxxxxxxxxxxxxxxxxx>
 
 	* Makefile.in (check): Add printf_dfp.o dependency to check in order to

Modified: libdfp/trunk/printf_dfp.c
==============================================================================
--- libdfp/trunk/printf_dfp.c (original)
+++ libdfp/trunk/printf_dfp.c Wed Jul 25 15:27:31 2012
@@ -1,6 +1,6 @@
 /* Function definition to convert DFP values to strings
 
-   Copyright (C) 2006, 2009, 2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2006-2012 Free Software Foundation, Inc.
 
    This file is part of the Decimal Floating Point C Library.
 

Modified: libdfp/trunk/sysdeps/dpd/dpd-private.c
==============================================================================
--- libdfp/trunk/sysdeps/dpd/dpd-private.c (original)
+++ libdfp/trunk/sysdeps/dpd/dpd-private.c Wed Jul 25 15:27:31 2012
@@ -752,6 +752,7 @@
   union ieee754r_Decimal32 d;
   d.sd = x;
   c_f =  c_decoder[d.ieee.c];
+  /* Consider replacing with a call to getexp_d* for hardware support  */
   exp = c_f.lm_exp << DECIMAL32_BEC_bits;
   exp += d.ieee.bec;
   exp -= DECIMAL32_Bias;
@@ -804,6 +805,7 @@
   union ieee754r_Decimal128 d;
   d.td = x;
   c_f =  c_decoder[d.ieee.c];
+  /* Consider replacing with a call to getexp_d* for hardware support  */
   exp = c_f.lm_exp << DECIMAL128_BEC_bits;
   exp += d.ieee.bec;
   exp -= DECIMAL128_Bias;

Modified: libdfp/trunk/sysdeps/powerpc/dfpu/numdigits.h
==============================================================================
--- libdfp/trunk/sysdeps/powerpc/dfpu/numdigits.h (original)
+++ libdfp/trunk/sysdeps/powerpc/dfpu/numdigits.h Wed Jul 25 15:27:31 2012
@@ -1,13 +1,14 @@
 /* Number of digits functions, optimized for Power6.
 
-   Copyright (C) 2006, 2007, 2008 IBM Corporation.
-   Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2006-2008 IBM Corporation.
+   Copyright (C) 2006-2012 Free Software Foundation, Inc.
 
    This file is part of the Decimal Floating Point C Library.
 
    Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
               Michael Meissner <meissner@xxxxxxxxxxxxxxxxxx>
               Peter Bergner <bergner@xxxxxxxxxxxxxxxxxx>
+	      Ryan S. Arnold <rsa@xxxxxxxxxxxxxxxxxx>
 
    The Decimal Floating Point C Library is free software; you can
    redistribute it and/or modify it under the terms of the GNU Lesser
@@ -56,6 +57,12 @@
 
 #ifndef FUNC_D
 # define FUNC_D(x)		PASTE(x,PASTE(d,_DECIMAL_SIZE))
+#endif
+
+#if _DECIMAL_SIZE != 128
+# define Q ""
+#else
+# define Q "q"
 #endif
 
 static inline int
@@ -121,32 +128,22 @@
   register DEC_TYPE tmp = x;
 #endif
   double f1, f2;
-  DEC_TYPE f3;
+  DEC_TYPE f3, f4;
   long long i1, i2;
   static union
   {
     int i[2];
     long long l;
     double f;
-  } u = { { 0, 1 } }, v = { { 0, 398 } };
+  } u = { { 0, 1 } }, v = { { 0, DECIMAL_BIAS } };
   asm (
-#if _DECIMAL_SIZE != 128
     /* Prep for a NAN test.  */
-    "dxex %0,%4\n\t"
+    "dxex" Q " %0,%4\n\t"
     "stfd %0,%3\n\t"
     /* We don't care what the exponent actually is, as long at it's less than
      * '369'.  Set the exponent to zero in preparation for the reround.  Biased
      * exponent '398' equals zero.*/
-    "diex %2,%5,%4\n\t"
-#else /* _DECIMAL_SIZE == 128  */
-    /* Prep for a NAN test.  */
-    "dxexq %0,%4\n\t"
-    "stfd %0,%3\n\t"
-    /* We don't care what the exponent actually is, as long at it's less than
-     * '369'.  Set the exponent to zero in preparation for the reround.  Biased
-     * exponent '398' equals zero.*/
-    "diexq %2,%5,%4\n\t"
-#endif
+    "diex" Q " %2,%5,%4\n\t"
   : "=&d"(f1), "=&d"(f2), "=&d"(f3), "=m"(i1)
   : "d"(tmp), "d"(v.f));
 
@@ -155,16 +152,10 @@
     return i1;
 
   asm (
-#if _DECIMAL_SIZE != 128
-    "drrnd %0,%3,%4,1\n\t" 
-    "dxex %1,%0\n\t"
+    "drrnd" Q " %0,%3,%4,1\n\t" 
+    "dxex" Q " %1,%0\n\t"
     "stfd %1,%2\n\t"
-#else /* _DECIMAL_SIZE == 128  */
-    "drrndq %0,%3,%4,1\n\t" 
-    "dxexq %1,%0\n\t"
-    "stfd %1,%2\n\t"
-#endif
-    : "=&d"(f1), "=&d"(f2), "=m"(i2)
+    : "=&d"(f4), "=&d"(f2), "=m"(i2)
     : "d"(u.f), "d"(f3));
 
   /* v.l holds the normalized reference exponent.
@@ -207,12 +198,6 @@
   union int_dbl d2;
 #endif
 
-#if _DECIMAL_SIZE != 128
-# define Q ""
-#else
-# define Q "q"
-#endif
-
   asm ("drrnd" Q " %0,%1,%2,1" : "=d"(rnd) : "d"(d.f), "d"(tmp));
   asm ("dxex" Q " %0,%1\n\t" : "=d"(tmp2) : "d"(rnd));
 

Modified: libdfp/trunk/tests/test-decode.c
==============================================================================
--- libdfp/trunk/tests/test-decode.c (original)
+++ libdfp/trunk/tests/test-decode.c Wed Jul 25 15:27:31 2012
@@ -1,6 +1,6 @@
 /* Test decoded facility.
 
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 Free Software Foundation, Inc.
 
    This file is part of the Decimal Floating Point C Library.
 
@@ -85,6 +85,7 @@
       /* Notice, this number exceeds DEC64_SUBNORMAL_MIN.  */
       {__LINE__,1E-399DD, "+0,000,000,000,000,000E-398" },
       {__LINE__, 9E370DD, "+0,000,000,000,000,090E+369"},
+      {__LINE__, 4E384DD, "+4,000,000,000,000,000E+369"},
 #else
       {__LINE__,1.00DD, "BID not supported."},
 #endif

Modified: libdfp/trunk/tests/test-istream.cpp
==============================================================================
--- libdfp/trunk/tests/test-istream.cpp (original)
+++ libdfp/trunk/tests/test-istream.cpp Wed Jul 25 15:27:31 2012
@@ -82,6 +82,7 @@
   {__LINE__, -9.999E-3DD, "-0.009999", "%Da", -1.0DD},
   {__LINE__, __builtin_infd64(), "inf", "%Da", -1.0DD},
   {__LINE__, __builtin_infd64(), "INF", "%Da", -1.0DD},
+  {__LINE__, 4E384DD, "4.0E384", "%Da", -1.0DD},
   /* You can't value compare nan to nan.  */
   /* {__LINE__, (0.0DD * __builtin_infd64()), "NAN", "%Da", -1.0DD},  */
   /* You can't value compare nan to nan.  */

Modified: libdfp/trunk/tests/test-numdigits.c
==============================================================================
--- libdfp/trunk/tests/test-numdigits.c (original)
+++ libdfp/trunk/tests/test-numdigits.c Wed Jul 25 15:27:31 2012
@@ -1,6 +1,6 @@
 /* Unit test the internal numdigitsd[32|64|128]() functions.
 
-   Copyright (C) 2010 Free Software Foundation, Inc.
+   Copyright (C) 2010-2012 Free Software Foundation, Inc.
 
    This file is part of the Decimal Floating Point C Library.
 
@@ -92,7 +92,7 @@
 
 d64_type printf_d64s[] =
 {
-/*  {__LINE__, 0.02E-2DD, 1,  "%d"},
+  {__LINE__, 0.02E-2DD, 1,  "%d"},
   {__LINE__, 0.0200E-2DD, 3,  "%d"},
   {__LINE__, 1.0E-2DD, 2,  "%d"},
   {__LINE__, 0.0000345E-2DD, 3,  "%d"},
@@ -100,7 +100,7 @@
   {__LINE__, 123456.0E-2DD, 7,  "%d"},
   {__LINE__, 123456.000E-2DD, 9,  "%d"},
   {__LINE__, 123456.000E-4DD, 9,  "%d"},
-  {__LINE__, 123456.000E-6DD, 9,  "%d"}, */
+  {__LINE__, 123456.000E-6DD, 9,  "%d"},
 
   /* Can't exceed __DEC64_MANT_DIG__.  This test has 17 digits but the
    * compiler will truncate it (or round) before it's passed   */

Modified: libdfp/trunk/tests/test-param.c
==============================================================================
--- libdfp/trunk/tests/test-param.c (original)
+++ libdfp/trunk/tests/test-param.c Wed Jul 25 15:27:31 2012
@@ -1,6 +1,6 @@
 /* Test parameter passing compliance with the ABI.
 
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 Free Software Foundation, Inc.
 
    This file is part of the Decimal Floating Point C Library.
 

Modified: libdfp/trunk/tests/test-printf.c
==============================================================================
--- libdfp/trunk/tests/test-printf.c (original)
+++ libdfp/trunk/tests/test-printf.c Wed Jul 25 15:27:31 2012
@@ -500,6 +500,8 @@
   {__LINE__, 9.999999999999999E379DD, "9.999999999999999e+379", "%.16Dg" },
   {__LINE__, 9.999999999999999E380DD, "9.999999999999999e+380", "%.16Dg" },
   {__LINE__, 9999999999999999E369DD, "9.999999999999999e+384", "%.16Dg" },
+  {__LINE__, 4E384DD, "4e+384", "%Dg" },
+  {__LINE__, 4E384DD, "4e+384", "%.Dg" },
 
 
   {0,0,0,0 }

Modified: libdfp/trunk/tests/test-strtod.c
==============================================================================
--- libdfp/trunk/tests/test-strtod.c (original)
+++ libdfp/trunk/tests/test-strtod.c Wed Jul 25 15:27:31 2012
@@ -89,7 +89,7 @@
 
 d_nan_type strtods_nan[] =
 {
-  /* Compare against the decoded declet for each representation of DEC_NAN since
+  /* Compare against the decoded declet for each representation of DEC_NAN
    * since you can't compare DEC_NAN to DEC_NAN.  */
   {__LINE__, "NaN", DECLET32_NAN, DECLET64_NAN, DECLET128_NAN},
   {__LINE__, "1.23456789E-7", "+1,234,568E-13", "+0,000,000,123,456,789E-15", "+0,000,000,000,000,000,000,000,000,123,456,789E-15" },
@@ -122,6 +122,14 @@
       _DC_P(__FILE__,dnanptr->line,dnanptr->d128, strtod128(dnanptr->input,NULL));
     }
 
+  {
+   #include "decode.h"
+    _Decimal64 d64 = strtod64("4e384",NULL);
+    printf("4e384DD: %.16Da\n", d64);
+   char dbuf[256];
+   printf("%s\n", decoded64(d64,dbuf));
+  }
+
   _REPORT();
 
   /* fail comes from scaffold.c  */

_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits