patches/glibc/2.9/270-ldbl-nexttowardf.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun May 03 09:50:16 2009 +0000 (2009-05-03)
branchnewlib
changeset 1366 5e5d1e6f55d3
permissions -rw-r--r--
Update the newlib devel branch with stuff from /trunk@1498.

-------- diffstat follows --------
/devel/newlib/configure | 336 176 160 0 +++++++------
/devel/newlib/Makefile.in | 12 3 9 0 -
/devel/newlib/scripts/build/kernel/linux.sh | 2 1 1 0
/devel/newlib/scripts/build/internals.sh | 1 0 1 0 -
/devel/newlib/scripts/build/libc/eglibc.sh | 1 0 1 0 -
/devel/newlib/scripts/build/mpfr.sh | 2 1 1 0
/devel/newlib/scripts/functions | 111 5 106 0 ----
/devel/newlib/scripts/config.guess | 7 5 2 0 +
/devel/newlib/scripts/config.sub | 3 2 1 0 +
/devel/newlib/scripts/saveSample.sh.in | 4 2 2 0
/devel/newlib/docs/overview.txt | 8 6 2 0 +
/devel/newlib/samples/armeb-unknown-linux-uclibc/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/sh4-unknown-linux-gnu/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/x86_64-unknown-linux-gnu/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/arm-unknown-elf/crosstool.config | 12 3 9 0 -
/devel/newlib/samples/armeb-unknown-eabi/crosstool.config | 2 0 2 0 -
/devel/newlib/samples/arm-unknown-linux-gnueabi/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/ia64-unknown-linux-gnu/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/x86_64-unknown-linux-uclibc/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/armeb-unknown-linux-gnueabi/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/powerpc-e500v2-linux-gnuspe/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/i686-nptl-linux-gnu/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/arm-unknown-linux-gnu/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/powerpc-unknown-linux-gnu/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/mips-unknown-linux-uclibc/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/arm-unknown-linux-uclibcgnueabi/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/arm-iphone-linux-gnueabi/crosstool.config | 8 4 4 0
/devel/newlib/samples/armeb-unknown-linux-gnu/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/powerpc-unknown_nofpu-linux-gnu/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/i586-geode-linux-uclibc/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/arm-unknown-linux-uclibc/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/powerpc-unknown-linux-uclibc/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/mips-unknown-elf/crosstool.config | 2 0 2 0 -
/devel/newlib/samples/powerpc-405-linux-gnu/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/armeb-unknown-linux-uclibcgnueabi/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/arm-unknown-eabi/crosstool.config | 12 3 9 0 -
/devel/newlib/samples/mipsel-unknown-linux-gnu/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/powerpc64-unknown-linux-gnu/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/alphaev56-unknown-linux-gnu/crosstool.config | 14 5 9 0 -
/devel/newlib/samples/powerpc-860-linux-gnu/crosstool.config | 14 5 9 0 -
/devel/newlib/config/kernel/linux.in | 108 2 106 0 ----
/devel/newlib/config/global/ct-behave.in | 22 13 9 0 +
/devel/newlib/config/global/download.in | 210 15 195 0 +-------
/devel/newlib/config/libc/glibc.in | 7 7 0 0 +
/devel/newlib/config/libc/glibc-eglibc.in-common | 15 14 1 0 +
45 files changed, 382 insertions(+), 839 deletions(-)
yann@1365
     1
Original patch from: gentoo/src/patchsets/glibc/2.9/1073_all_glibc-ldbl-nexttowardf.patch
yann@1365
     2
yann@1365
     3
-= BEGIN original header =-
yann@1365
     4
ripped from Debian
yann@1365
     5
yann@1365
     6
this change was made to generic __nexttowardf, but not the long double version
yann@1365
     7
yann@1365
     8
2008-05-05  Aurelien Jarno  <aurelien@aurel32.net>
yann@1365
     9
yann@1365
    10
	* sysdeps/ieee754/ldbl-128/s_nexttowardf.c: Include float.h.
yann@1365
    11
	(__nexttowardf): Use math_opt_barrier and
yann@1365
    12
	math_force_eval macros.  If FLT_EVAL_METHOD is not 0, force
yann@1365
    13
	x to float using asm.
yann@1365
    14
yann@1365
    15
-= END original header =-
yann@1365
    16
yann@1365
    17
diff -durN glibc-2_9.orig/sysdeps/ieee754/ldbl-128/s_nexttowardf.c glibc-2_9/sysdeps/ieee754/ldbl-128/s_nexttowardf.c
yann@1365
    18
--- glibc-2_9.orig/sysdeps/ieee754/ldbl-128/s_nexttowardf.c	1999-07-14 02:09:42.000000000 +0200
yann@1365
    19
+++ glibc-2_9/sysdeps/ieee754/ldbl-128/s_nexttowardf.c	2009-02-02 22:00:59.000000000 +0100
yann@1365
    20
@@ -19,7 +19,8 @@
yann@1365
    21
 #endif
yann@1365
    22
 
yann@1365
    23
 #include "math.h"
yann@1365
    24
-#include "math_private.h"
yann@1365
    25
+#include <math_private.h>
yann@1365
    26
+#include <float.h>
yann@1365
    27
 
yann@1365
    28
 #ifdef __STDC__
yann@1365
    29
 	float __nexttowardf(float x, long double y)
yann@1365
    30
@@ -44,10 +45,12 @@
yann@1365
    31
 	   return x+y;
yann@1365
    32
 	if((long double) x==y) return y;	/* x=y, return y */
yann@1365
    33
 	if(ix==0) {				/* x == 0 */
yann@1365
    34
-	    float x2;
yann@1365
    35
+	    float u;
yann@1365
    36
 	    SET_FLOAT_WORD(x,(u_int32_t)((hy>>32)&0x80000000)|1);/* return +-minsub*/
yann@1365
    37
-	    x2 = x*x;
yann@1365
    38
-	    if(x2==x) return x2; else return x;	/* raise underflow flag */
yann@1365
    39
+	    u = math_opt_barrier (x);
yann@1365
    40
+	    u = u * u;
yann@1365
    41
+	    math_force_eval (u);		/* raise underflow flag */
yann@1365
    42
+	    return x;
yann@1365
    43
 	}
yann@1365
    44
 	if(hx>=0) {				/* x > 0 */
yann@1365
    45
 	    if(hy<0||(ix>>23)>(iy>>48)-0x3f80
yann@1365
    46
@@ -67,13 +70,16 @@
yann@1365
    47
 	    }
yann@1365
    48
 	}
yann@1365
    49
 	hy = hx&0x7f800000;
yann@1365
    50
-	if(hy>=0x7f800000) return x+x;	/* overflow  */
yann@1365
    51
+	if(hy>=0x7f800000) {
yann@1365
    52
+	  x = x+x;	/* overflow  */
yann@1365
    53
+	  if (FLT_EVAL_METHOD != 0)
yann@1365
    54
+	    /* Force conversion to float.  */
yann@1365
    55
+	    asm ("" : "+m"(x));
yann@1365
    56
+	  return x;
yann@1365
    57
+	}
yann@1365
    58
 	if(hy<0x00800000) {		/* underflow */
yann@1365
    59
-	    float x2 = x*x;
yann@1365
    60
-	    if(x2!=x) {		/* raise underflow flag */
yann@1365
    61
-	        SET_FLOAT_WORD(x2,hx);
yann@1365
    62
-		return x2;
yann@1365
    63
-	    }
yann@1365
    64
+	    float u = x*x;
yann@1365
    65
+	    math_force_eval (u);	/* raise underflow flag */
yann@1365
    66
 	}
yann@1365
    67
 	SET_FLOAT_WORD(x,hx);
yann@1365
    68
 	return x;