about summary refs log tree commit diff
path: root/sysdeps/i386/fpu/e_log.S
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-10-14 23:41:47 -0400
committerUlrich Drepper <drepper@gmail.com>2011-10-14 23:41:47 -0400
commit38ad40ceca8ba35761e79cfce4aaef0d0f7583e6 (patch)
tree336de2d8f4b91a770418446fe2c322662d321bcd /sysdeps/i386/fpu/e_log.S
parent396a21b1d016c52e011f8921e0728aa62a1e9df0 (diff)
downloadglibc-38ad40ceca8ba35761e79cfce4aaef0d0f7583e6.tar.gz
glibc-38ad40ceca8ba35761e79cfce4aaef0d0f7583e6.tar.xz
glibc-38ad40ceca8ba35761e79cfce4aaef0d0f7583e6.zip
Optimize x86-32 log
Diffstat (limited to 'sysdeps/i386/fpu/e_log.S')
-rw-r--r--sysdeps/i386/fpu/e_log.S20
1 files changed, 19 insertions, 1 deletions
diff --git a/sysdeps/i386/fpu/e_log.S b/sysdeps/i386/fpu/e_log.S
index 8110a84535..a2e4d89a40 100644
--- a/sysdeps/i386/fpu/e_log.S
+++ b/sysdeps/i386/fpu/e_log.S
@@ -62,4 +62,22 @@ ENTRY(__ieee754_log)
 	fstp	%st(1)
 	ret
 END (__ieee754_log)
-strong_alias (__ieee754_log, __log_finite)
+
+ENTRY(__log_finite)
+	fldln2			// log(2)
+	fldl	4(%esp)		// x : log(2)
+#ifdef PIC
+	LOAD_PIC_REG (dx)
+#endif
+	fld	%st		// x : x : log(2)
+	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)
+	fnstsw			// x-1 : x : log(2)
+	andb	$0x45, %ah
+	jz	2b
+	fstp	%st(1)		// x-1 : log(2)
+	fyl2xp1			// log(x)
+	ret
+END(__log_finite)