patches/glibc/ports-2.10.1/210-ldbl-nexttowardf.patch
changeset 1625 fde082da9813
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/glibc/ports-2.10.1/210-ldbl-nexttowardf.patch	Fri Nov 13 21:37:18 2009 +0100
     1.3 @@ -0,0 +1,66 @@
     1.4 +ripped from Debian
     1.5 +
     1.6 +this change was made to generic __nexttowardf, but not the long double version
     1.7 +
     1.8 +2008-05-05  Aurelien Jarno  <aurelien@aurel32.net>
     1.9 +
    1.10 +	* sysdeps/ieee754/ldbl-128/s_nexttowardf.c: Include float.h.
    1.11 +	(__nexttowardf): Use math_opt_barrier and
    1.12 +	math_force_eval macros.  If FLT_EVAL_METHOD is not 0, force
    1.13 +	x to float using asm.
    1.14 +
    1.15 + sysdeps/ieee754/ldbl-128/s_nexttowardf.c |   26 ++++++++++++++++----------
    1.16 + 1 file changed, 16 insertions(+), 10 deletions(-)
    1.17 +
    1.18 +diff -durN glibc-2.10.1.orig/sysdeps/ieee754/ldbl-128/s_nexttowardf.c glibc-2.10.1/sysdeps/ieee754/ldbl-128/s_nexttowardf.c
    1.19 +--- glibc-2.10.1.orig/sysdeps/ieee754/ldbl-128/s_nexttowardf.c	1999-07-14 02:09:42.000000000 +0200
    1.20 ++++ glibc-2.10.1/sysdeps/ieee754/ldbl-128/s_nexttowardf.c	2009-11-13 00:50:06.000000000 +0100
    1.21 +@@ -19,7 +19,8 @@
    1.22 + #endif
    1.23 + 
    1.24 + #include "math.h"
    1.25 +-#include "math_private.h"
    1.26 ++#include <math_private.h>
    1.27 ++#include <float.h>
    1.28 + 
    1.29 + #ifdef __STDC__
    1.30 + 	float __nexttowardf(float x, long double y)
    1.31 +@@ -44,10 +45,12 @@
    1.32 + 	   return x+y;
    1.33 + 	if((long double) x==y) return y;	/* x=y, return y */
    1.34 + 	if(ix==0) {				/* x == 0 */
    1.35 +-	    float x2;
    1.36 ++	    float u;
    1.37 + 	    SET_FLOAT_WORD(x,(u_int32_t)((hy>>32)&0x80000000)|1);/* return +-minsub*/
    1.38 +-	    x2 = x*x;
    1.39 +-	    if(x2==x) return x2; else return x;	/* raise underflow flag */
    1.40 ++	    u = math_opt_barrier (x);
    1.41 ++	    u = u * u;
    1.42 ++	    math_force_eval (u);		/* raise underflow flag */
    1.43 ++	    return x;
    1.44 + 	}
    1.45 + 	if(hx>=0) {				/* x > 0 */
    1.46 + 	    if(hy<0||(ix>>23)>(iy>>48)-0x3f80
    1.47 +@@ -67,13 +70,16 @@
    1.48 + 	    }
    1.49 + 	}
    1.50 + 	hy = hx&0x7f800000;
    1.51 +-	if(hy>=0x7f800000) return x+x;	/* overflow  */
    1.52 ++	if(hy>=0x7f800000) {
    1.53 ++	  x = x+x;	/* overflow  */
    1.54 ++	  if (FLT_EVAL_METHOD != 0)
    1.55 ++	    /* Force conversion to float.  */
    1.56 ++	    asm ("" : "+m"(x));
    1.57 ++	  return x;
    1.58 ++	}
    1.59 + 	if(hy<0x00800000) {		/* underflow */
    1.60 +-	    float x2 = x*x;
    1.61 +-	    if(x2!=x) {		/* raise underflow flag */
    1.62 +-	        SET_FLOAT_WORD(x2,hx);
    1.63 +-		return x2;
    1.64 +-	    }
    1.65 ++	    float u = x*x;
    1.66 ++	    math_force_eval (u);	/* raise underflow flag */
    1.67 + 	}
    1.68 + 	SET_FLOAT_WORD(x,hx);
    1.69 + 	return x;