about summary refs log tree commit diff
path: root/sysdeps/i386/fpu
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/i386/fpu')
-rw-r--r--sysdeps/i386/fpu/e_log2.S (renamed from sysdeps/i386/fpu/s_log2.S)5
-rw-r--r--sysdeps/i386/fpu/e_log2f.S (renamed from sysdeps/i386/fpu/s_log2f.S)5
-rw-r--r--sysdeps/i386/fpu/e_log2l.S (renamed from sysdeps/i386/fpu/s_log2l.S)5
-rw-r--r--sysdeps/i386/fpu/s_frexpl.S23
-rw-r--r--sysdeps/i386/fpu/s_ilogb.S14
-rw-r--r--sysdeps/i386/fpu/s_ilogbf.S14
-rw-r--r--sysdeps/i386/fpu/s_ilogbl.S14
7 files changed, 50 insertions, 30 deletions
diff --git a/sysdeps/i386/fpu/s_log2.S b/sysdeps/i386/fpu/e_log2.S
index 5ba40761e9..4f7f0d57d9 100644
--- a/sysdeps/i386/fpu/s_log2.S
+++ b/sysdeps/i386/fpu/e_log2.S
@@ -32,7 +32,7 @@ limit:	.double 0.29
 #endif
 
 	.text
-ENTRY(__log2)
+ENTRY(__ieee754_log2)
 #ifdef PIC
 	call	1f
 1:	popl	%edx
@@ -64,5 +64,4 @@ ENTRY(__log2)
 	fstp	%st(1)
 	fstp	%st(1)
 	ret
-END (__log2)
-weak_alias (__log2, log2)
+END (__ieee754_log2)
diff --git a/sysdeps/i386/fpu/s_log2f.S b/sysdeps/i386/fpu/e_log2f.S
index 111dc9c1d9..88f28b423c 100644
--- a/sysdeps/i386/fpu/s_log2f.S
+++ b/sysdeps/i386/fpu/e_log2f.S
@@ -32,7 +32,7 @@ limit:	.double 0.29
 #endif
 
 	.text
-ENTRY(__log2f)
+ENTRY(__ieee754_log2f)
 #ifdef PIC
 	call	1f
 1:	popl	%edx
@@ -64,5 +64,4 @@ ENTRY(__log2f)
 	fstp	%st(1)
 	fstp	%st(1)
 	ret
-END (__log2f)
-weak_alias (__log2f, log2f)
+END (__ieee754_log2f)
diff --git a/sysdeps/i386/fpu/s_log2l.S b/sysdeps/i386/fpu/e_log2l.S
index 7b645d57ab..f5c661a2d1 100644
--- a/sysdeps/i386/fpu/s_log2l.S
+++ b/sysdeps/i386/fpu/e_log2l.S
@@ -32,7 +32,7 @@ limit:	.double 0.29
 #endif
 
 	.text
-ENTRY(__log2l)
+ENTRY(__ieee754_log2l)
 #ifdef PIC
 	call	1f
 1:	popl	%edx
@@ -64,5 +64,4 @@ ENTRY(__log2l)
 	fstp	%st(1)
 	fstp	%st(1)
 	ret
-END (__log2l)
-weak_alias (__log2l, log2l)
+END (__ieee754_log2l)
diff --git a/sysdeps/i386/fpu/s_frexpl.S b/sysdeps/i386/fpu/s_frexpl.S
index 2645d220ee..56b1456fcb 100644
--- a/sysdeps/i386/fpu/s_frexpl.S
+++ b/sysdeps/i386/fpu/s_frexpl.S
@@ -1,5 +1,5 @@
 /* ix87 specific frexp implementation for long double.
-   Copyright (C) 1997, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2000, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -32,12 +32,6 @@
 	ASM_TYPE_DIRECTIVE(two64,@object)
 two64:	.byte 0, 0, 0, 0, 0, 0, 0xf0, 0x43
 	ASM_SIZE_DIRECTIVE(two64)
-	/* The following is LDBL_MAX / ldexp (1.0, 64), the largest
-	   number we can handle the normal way.  */
-	ASM_TYPE_DIRECTIVE(largest,@object)
-largest:
-	.byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbe, 0x7f, 0, 0
-	ASM_SIZE_DIRECTIVE(largest)
 
 #ifdef PIC
 #define MO(op) op##@GOTOFF(%edx)
@@ -67,10 +61,7 @@ ENTRY (BP_SYM (__frexpl))
 	je	1f
 
 	cmpl	$0, %eax
-	je	2f
-
-	cmpl	$0x7fbe, %eax
-	ja	4f
+	jne	2f
 
 	fldt	VAL0(%esp)
 #ifdef	PIC
@@ -102,15 +93,5 @@ ENTRY (BP_SYM (__frexpl))
 
 	LEAVE
 	ret
-
-4:	movl	VAL2(%esp), %ecx
-	movl	%ecx, %edx
-	andl	$0x7fff, %ecx
-
-	andl	$0x8000, %edx
-	subl	$16382, %ecx
-	orl	$0x3ffe, %edx
-	movl	%edx, VAL2(%esp)
-	jmp	1b
 END (BP_SYM (__frexpl))
 weak_alias (BP_SYM (__frexpl), BP_SYM (frexpl))
diff --git a/sysdeps/i386/fpu/s_ilogb.S b/sysdeps/i386/fpu/s_ilogb.S
index 36fb000c02..68d9c1a680 100644
--- a/sysdeps/i386/fpu/s_ilogb.S
+++ b/sysdeps/i386/fpu/s_ilogb.S
@@ -9,6 +9,16 @@ RCSID("$NetBSD: s_ilogb.S,v 1.5 1995/10/12 15:53:09 jtc Exp $")
 
 ENTRY(__ilogb)
 	fldl	4(%esp)
+/* I added the following ugly construct because ilogb(+-Inf) is
+   required to return INT_MAX in ISO C99.
+   -- jakub@redhat.com.  */
+	fxam			/* Is NaN or +-Inf?  */
+	fstsw   %ax
+	movb    $0x45, %dh
+	andb    %ah, %dh
+	cmpb    $0x05, %dh
+	je      1f		/* Is +-Inf, jump.  */
+
 	fxtract
 	pushl	%eax
 	fstp	%st
@@ -18,5 +28,9 @@ ENTRY(__ilogb)
 	popl	%eax
 
 	ret
+
+1:	fstp	%st
+	movl	$0x7fffffff, %eax
+	ret
 END (__ilogb)
 weak_alias (__ilogb, ilogb)
diff --git a/sysdeps/i386/fpu/s_ilogbf.S b/sysdeps/i386/fpu/s_ilogbf.S
index 54f9d4647e..521afe2b60 100644
--- a/sysdeps/i386/fpu/s_ilogbf.S
+++ b/sysdeps/i386/fpu/s_ilogbf.S
@@ -9,6 +9,16 @@ RCSID("$NetBSD: s_ilogbf.S,v 1.4 1995/10/22 20:32:43 pk Exp $")
 
 ENTRY(__ilogbf)
 	flds	4(%esp)
+/* I added the following ugly construct because ilogb(+-Inf) is
+   required to return INT_MAX in ISO C99.
+   -- jakub@redhat.com.  */
+	fxam			/* Is NaN or +-Inf?  */
+	fstsw   %ax
+	movb    $0x45, %dh
+	andb    %ah, %dh
+	cmpb    $0x05, %dh
+	je      1f		/* Is +-Inf, jump.  */
+
 	fxtract
 	pushl	%eax
 	fstp	%st
@@ -18,5 +28,9 @@ ENTRY(__ilogbf)
 	popl	%eax
 
 	ret
+
+1:	fstp	%st
+	movl	$0x7fffffff, %eax
+	ret
 END (__ilogbf)
 weak_alias (__ilogbf, ilogbf)
diff --git a/sysdeps/i386/fpu/s_ilogbl.S b/sysdeps/i386/fpu/s_ilogbl.S
index 1dad93abeb..ed547bdc8b 100644
--- a/sysdeps/i386/fpu/s_ilogbl.S
+++ b/sysdeps/i386/fpu/s_ilogbl.S
@@ -10,6 +10,16 @@ RCSID("$NetBSD: $")
 
 ENTRY(__ilogbl)
 	fldt	4(%esp)
+/* I added the following ugly construct because ilogb(+-Inf) is
+   required to return INT_MAX in ISO C99.
+   -- jakub@redhat.com.  */
+	fxam			/* Is NaN or +-Inf?  */
+	fstsw   %ax
+	movb    $0x45, %dh
+	andb    %ah, %dh
+	cmpb    $0x05, %dh
+	je      1f		/* Is +-Inf, jump.  */
+
 	fxtract
 	pushl	%eax
 	fstp	%st
@@ -19,5 +29,9 @@ ENTRY(__ilogbl)
 	popl	%eax
 
 	ret
+
+1:	fstp	%st
+	movl	$0x7fffffff, %eax
+	ret
 END (__ilogbl)
 weak_alias (__ilogbl, ilogbl)