summary refs log tree commit diff
path: root/sysdeps/i386
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-03-15 20:10:51 +0000
committerUlrich Drepper <drepper@redhat.com>2007-03-15 20:10:51 +0000
commit6b2665f534dd34c20f31dc6e3540114762a8d3a8 (patch)
treee32593b105af2dea5c2397b7527f0e0348656b95 /sysdeps/i386
parent44969f17bb8e323ab66799f73a05d23a5a2cf83a (diff)
downloadglibc-6b2665f534dd34c20f31dc6e3540114762a8d3a8.tar.gz
glibc-6b2665f534dd34c20f31dc6e3540114762a8d3a8.tar.xz
glibc-6b2665f534dd34c20f31dc6e3540114762a8d3a8.zip
[BZ #3919]
	* math/libm-test.inc (log_test): Test -Inf and NaN.
	(log10_test, log1p_test, log2_test): Test -Inf.
	* sysdeps/i386/fpu/e_log.S (__ieee754_log): Don't raise
	FE_INVALID when argument is qNaN.
	* sysdeps/i386/fpu/e_logl.S (__ieee754_logl): Likewise.
	* sysdeps/i386/fpu/e_logf.S (__ieee754_logf): Likewise.
	* sysdeps/x86_64/fpu/e_logl.S (__ieee754_logl): Likewise.
	* sysdeps/x86_64/fpu/e_log10l.S (__ieee754_log10l): Replace
	andb $1, %ah with testb $1, %ah, don't test for parity, instead
	testb $4, %ah and jump if non-zero.
	* sysdeps/x86_64/fpu/e_log2l.S (__ieee754_log2l): Likewise.
	* sysdeps/x86_64/fpu/s_log1pl.S (__log1pl): Likewise.

2007-03-15  Jakub Jelinek  <jakub@redhat.com>
Diffstat (limited to 'sysdeps/i386')
-rw-r--r--sysdeps/i386/fpu/e_log.S11
-rw-r--r--sysdeps/i386/fpu/e_logf.S11
-rw-r--r--sysdeps/i386/fpu/e_logl.S11
3 files changed, 30 insertions, 3 deletions
diff --git a/sysdeps/i386/fpu/e_log.S b/sysdeps/i386/fpu/e_log.S
index 5604e638f5..ce55b72292 100644
--- a/sysdeps/i386/fpu/e_log.S
+++ b/sysdeps/i386/fpu/e_log.S
@@ -36,11 +36,15 @@ limit:	.double 0.29
 ENTRY(__ieee754_log)
 	fldln2			// log(2)
 	fldl	4(%esp)		// x : log(2)
+	fxam
+	fnstsw
 #ifdef PIC
 	LOAD_PIC_REG (dx)
 #endif
 	fld	%st		// x : x : log(2)
-	fsubl	MO(one)		// x-1 : x : log(2)
+	sahf
+	jc	3f		// in case x is NaN or +-Inf
+4:	fsubl	MO(one)		// x-1 : x : log(2)
 	fld	%st		// x-1 : x-1 : x : log(2)
 	fabs			// |x-1| : x-1 : x : log(2)
 	fcompl	MO(limit)	// x-1 : x : log(2)
@@ -54,4 +58,9 @@ ENTRY(__ieee754_log)
 2:	fstp	%st(0)		// x : log(2)
 	fyl2x			// log(x)
 	ret
+
+3:	jp	4b		// in case x is +-Inf
+	fstp	%st(1)
+	fstp	%st(1)
+	ret
 END (__ieee754_log)
diff --git a/sysdeps/i386/fpu/e_logf.S b/sysdeps/i386/fpu/e_logf.S
index 128bb2754c..cd4538b594 100644
--- a/sysdeps/i386/fpu/e_logf.S
+++ b/sysdeps/i386/fpu/e_logf.S
@@ -37,11 +37,15 @@ limit:	.double 0.29
 ENTRY(__ieee754_logf)
 	fldln2			// log(2)
 	flds	4(%esp)		// x : log(2)
+	fxam
+	fnstsw
 #ifdef PIC
 	LOAD_PIC_REG (dx)
 #endif
 	fld	%st		// x : x : log(2)
-	fsubl	MO(one)		// x-1 : x : log(2)
+	sahf
+	jc	3f		// in case x is NaN or +-Inf
+4:	fsubl	MO(one)		// x-1 : x : log(2)
 	fld	%st		// x-1 : x-1 : x : log(2)
 	fabs			// |x-1| : x-1 : x : log(2)
 	fcompl	MO(limit)	// x-1 : x : log(2)
@@ -55,4 +59,9 @@ ENTRY(__ieee754_logf)
 2:	fstp	%st(0)		// x : log(2)
 	fyl2x			// log(x)
 	ret
+
+3:	jp	4b		// in case x is +-Inf
+	fstp	%st(1)
+	fstp	%st(1)
+	ret
 END (__ieee754_logf)
diff --git a/sysdeps/i386/fpu/e_logl.S b/sysdeps/i386/fpu/e_logl.S
index 5023d3012f..551dcf1e46 100644
--- a/sysdeps/i386/fpu/e_logl.S
+++ b/sysdeps/i386/fpu/e_logl.S
@@ -37,11 +37,15 @@ limit:	.double 0.29
 ENTRY(__ieee754_logl)
 	fldln2			// log(2)
 	fldt	4(%esp)		// x : log(2)
+	fxam
+	fnstsw
 #ifdef PIC
 	LOAD_PIC_REG (dx)
 #endif
 	fld	%st		// x : x : log(2)
-	fsubl	MO(one)		// x-1 : x : log(2)
+	sahf
+	jc	3f		// in case x is NaN or +-Inf
+4:	fsubl	MO(one)		// x-1 : x : log(2)
 	fld	%st		// x-1 : x-1 : x : log(2)
 	fabs			// |x-1| : x-1 : x : log(2)
 	fcompl	MO(limit)	// x-1 : x : log(2)
@@ -55,4 +59,9 @@ ENTRY(__ieee754_logl)
 2:	fstp	%st(0)		// x : log(2)
 	fyl2x			// log(x)
 	ret
+
+3:	jp	4b		// in case x is +-Inf
+	fstp	%st(1)
+	fstp	%st(1)
+	ret
 END (__ieee754_logl)