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

[Commits] r17731 - in /fsf/trunk/ports: ./ sysdeps/m68k/m680x0/fpu/ sysdeps/m68k/m680x0/fpu/bits/



Author: eglibc
Date: Sat Mar 24 00:02:24 2012
New Revision: 17731

Log:
Import glibc-ports-mainline for 2012-03-24

Modified:
    fsf/trunk/ports/ChangeLog.m68k
    fsf/trunk/ports/sysdeps/m68k/m680x0/fpu/bits/mathinline.h
    fsf/trunk/ports/sysdeps/m68k/m680x0/fpu/libm-test-ulps
    fsf/trunk/ports/sysdeps/m68k/m680x0/fpu/s_cexp.c

Modified: fsf/trunk/ports/ChangeLog.m68k
==============================================================================
--- fsf/trunk/ports/ChangeLog.m68k (original)
+++ fsf/trunk/ports/ChangeLog.m68k Sat Mar 24 00:02:24 2012
@@ -1,3 +1,15 @@
+2012-03-23  Andreas Schwab  <schwab@xxxxxxxxxxxxxx>
+
+	* sysdeps/m68k/m680x0/fpu/libm-test-ulps: Update.
+
+	* sysdeps/m68k/m680x0/fpu/s_cexp.c: Avoid undue overflow.
+
+	* sysdeps/m68k/m680x0/fpu/bits/mathinline.h (__inline_mathop1):
+	Mark asm as volatile.
+	(__scalbn): Likewise.
+	(__lrint): Likewise.
+	(__sincos): Likewise.
+
 2012-03-22  Andreas Schwab  <schwab@xxxxxxxxxxxxxx>
 
 	* sysdeps/m68k/m680x0/fpu/libm-test-ulps: Update.

Modified: fsf/trunk/ports/sysdeps/m68k/m680x0/fpu/bits/mathinline.h
==============================================================================
--- fsf/trunk/ports/sysdeps/m68k/m680x0/fpu/bits/mathinline.h (original)
+++ fsf/trunk/ports/sysdeps/m68k/m680x0/fpu/bits/mathinline.h Sat Mar 24 00:02:24 2012
@@ -146,7 +146,8 @@
   __m81_defun (float_type, func, (float_type __mathop_x))		      \
   {									      \
     float_type __result;						      \
-    __asm("f" __STRING(op) "%.x %1, %0" : "=f" (__result) : "f" (__mathop_x));\
+    __asm __volatile__ ("f" __STRING(op) "%.x %1, %0"			      \
+			: "=f" (__result) : "f" (__mathop_x));		      \
     return __result;							      \
   }
 
@@ -243,8 +244,8 @@
   /* There is no branch-condition for infinity,				  \
      so we must extract and examine the condition codes manually.  */	  \
   unsigned long int __fpsr;						  \
-  __asm("ftst%.x %1\n"							  \
-	"fmove%.l %/fpsr, %0" : "=dm" (__fpsr) : "f" (__value));	  \
+  __asm ("ftst%.x %1\n"							  \
+	 "fmove%.l %/fpsr, %0" : "=dm" (__fpsr) : "f" (__value));	  \
   return (__fpsr & (2 << 24)) ? (__fpsr & (8 << 24) ? -1 : 1) : 0;	  \
 }									  \
 									  \
@@ -262,7 +263,8 @@
 	     (float_type __x, int __n))					  \
 {									  \
   float_type __result;							  \
-  __asm ("fscale%.l %1, %0" : "=f" (__result) : "dmi" (__n), "0" (__x));  \
+  __asm __volatile__  ("fscale%.l %1, %0" : "=f" (__result)		  \
+		       : "dmi" (__n), "0" (__x));			  \
   return __result;							  \
 }
 
@@ -279,8 +281,8 @@
 __m81_defun (int, __CONCAT(__isnan,s), (float_type __value))	  	  \
 {									  \
   char __result;							  \
-  __asm("ftst%.x %1\n"							  \
-	"fsun %0" : "=dm" (__result) : "f" (__value));			  \
+  __asm ("ftst%.x %1\n"							  \
+	 "fsun %0" : "=dm" (__result) : "f" (__value));			  \
   return __result;							  \
 }
 
@@ -319,7 +321,7 @@
 __m81_defun (long int, __CONCAT(__lrint,s), (float_type __x))		  \
 {									  \
   long int __result;							  \
-  __asm ("fmove%.l %1, %0" : "=dm" (__result) : "f" (__x));		  \
+  __asm __volatile__ ("fmove%.l %1, %0" : "=dm" (__result) : "f" (__x));  \
   return __result;							  \
 }
 
@@ -337,8 +339,8 @@
 __NTH (__m81_u(__CONCAT(__sincos,s))(float_type __x, float_type *__sinx, \
 				     float_type *__cosx))		\
 {									\
-  __asm ("fsincos%.x %2,%1:%0"						\
-	 : "=f" (*__sinx), "=f" (*__cosx) : "f" (__x));			\
+  __asm __volatile__ ("fsincos%.x %2,%1:%0"				\
+		      : "=f" (*__sinx), "=f" (*__cosx) : "f" (__x));	\
 }
 
 __inline_functions (double,)

Modified: fsf/trunk/ports/sysdeps/m68k/m680x0/fpu/libm-test-ulps
==============================================================================
--- fsf/trunk/ports/sysdeps/m68k/m680x0/fpu/libm-test-ulps (original)
+++ fsf/trunk/ports/sysdeps/m68k/m680x0/fpu/libm-test-ulps Sat Mar 24 00:02:24 2012
@@ -448,6 +448,9 @@
 Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
 float: 1
 ifloat: 1
+Test "Real part of: cexp (-95 + 0.75 i) == 4.039714446238306526889476684000081624047e-42 + 3.763383677300535390271646960780570275931e-42 i":
+ildouble: 1
+ldouble: 1
 Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
 float: 2
 ifloat: 2
@@ -456,7 +459,19 @@
 ifloat: 1
 ildouble: 1
 ldouble: 1
+Test "Imaginary part of: cexp (11356.5625 + 0.75 i) == 9.052188470850960144814815984311663764287e4931 + 8.432986734191301036267148978260970230200e4931 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: cexp (50 + 0x1p127 i) == 4.053997150228616856622417636046265337193e21 + 3.232070315463388524466674772633810238819e21 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: cexp (709.8125 + 0.75 i) == 1.355121963080879535248452862759108365762e308 + 1.262426823598609432507811340856186873507e308 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: cexp (88.75 + 0.75 i) == 2.558360358486542817001900410314204322891e38 + 2.383359453227311447654736314679677655100e38 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cexp (88.75 + 0.75 i) == 2.558360358486542817001900410314204322891e38 + 2.383359453227311447654736314679677655100e38 i":
 ildouble: 1
 ldouble: 1
 
@@ -1134,8 +1149,8 @@
 ildouble: 2
 ldouble: 2
 Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6":
-float: 2
-ifloat: 2
+float: 3
+ifloat: 3
 ildouble: 1
 ldouble: 1
 Test "jn (2, 0x1.ffff62p+99) == -4.43860668048170034334926693188979974489e-16":

Modified: fsf/trunk/ports/sysdeps/m68k/m680x0/fpu/s_cexp.c
==============================================================================
--- fsf/trunk/ports/sysdeps/m68k/m680x0/fpu/s_cexp.c (original)
+++ fsf/trunk/ports/sysdeps/m68k/m680x0/fpu/s_cexp.c Sat Mar 24 00:02:24 2012
@@ -17,6 +17,7 @@
    License along with the GNU C Library.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <float.h>
 #include <complex.h>
 #include <math.h>
 #include "mathimpl.h"
@@ -43,26 +44,46 @@
   if ((ix_cond & (__M81_COND_NAN|__M81_COND_INF)) == 0)
     {
       /* Imaginary part is finite.  */
-      float_type exp_val = m81(__ieee754_exp) (__real__ x);
+      unsigned long rx_cond = __m81_test (__real__ x);
 
-      __real__ retval = __imag__ retval = exp_val;
-      if (m81(__finite) (exp_val))
+      if ((rx_cond & (__M81_COND_NAN|__M81_COND_INF)) == 0)
 	{
-	  float_type sin_ix, cos_ix;
-	  __asm ("fsincos%.x %2,%1:%0" : "=f" (sin_ix), "=f" (cos_ix)
-		 : "f" (__imag__ x));
-	  __real__ retval *= cos_ix;
+	  const int t = (int) ((LDBL_MAX_EXP - 1) * M_LN2l);
+	  long double sin_ix, cos_ix, exp_val;
+
+	  __m81_u (__sincosl) (__imag__ x, &sin_ix, &cos_ix);
+
+	  if (__real__ x > t)
+	    {
+	      long double exp_t = __m81_u(__ieee754_expl) (t);
+	      __real__ x -= t;
+	      sin_ix *= exp_t;
+	      cos_ix *= exp_t;
+	      if (__real__ x > t)
+		{
+		  __real__ x -= t;
+		  sin_ix *= exp_t;
+		  cos_ix *= exp_t;
+		}
+	    }
+
+	  exp_val = __m81_u(__ieee754_expl) (__real__ x);
+	  __real__ retval = exp_val * cos_ix;
 	  if (ix_cond & __M81_COND_ZERO)
 	    __imag__ retval = __imag__ x;
 	  else
-	    __imag__ retval *= sin_ix;
+	    __imag__ retval = exp_val * sin_ix;
 	}
       else
 	{
 	  /* Compute the sign of the result.  */
-	  float_type remainder, pi_2;
+	  long double remainder, pi_2;
 	  int quadrant;
 
+	  if ((rx_cond & (__M81_COND_NAN|__M81_COND_NEG)) == __M81_COND_NEG)
+	    __real__ retval = __imag__ retval = 0.0;
+	  else
+	    __real__ retval = __imag__ retval = __real__ x;
 	  __asm ("fmovecr %#0,%0\n\tfscale%.w %#-1,%0" : "=f" (pi_2));
 	  __asm ("fmod%.x %2,%0\n\tfmove%.l %/fpsr,%1"
 		 : "=f" (remainder), "=dm" (quadrant)
@@ -83,7 +104,7 @@
 	      __imag__ retval = -__imag__ retval;
 	      break;
 	    }
-	  if (ix_cond & __M81_COND_ZERO && !m81(__isnan) (exp_val))
+	  if (ix_cond & __M81_COND_ZERO && (rx_cond & __M81_COND_NAN) == 0)
 	    __imag__ retval = __imag__ x;
 	}
     }

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