about summary refs log tree commit diff
path: root/sysdeps/i386/fpu/e_log.S
diff options
context:
space:
mode:
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)