summaryrefslogtreecommitdiff
path: root/libc/sysdeps/i386/fpu/e_logf.S
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/i386/fpu/e_logf.S')
-rw-r--r--libc/sysdeps/i386/fpu/e_logf.S29
1 files changed, 23 insertions, 6 deletions
diff --git a/libc/sysdeps/i386/fpu/e_logf.S b/libc/sysdeps/i386/fpu/e_logf.S
index cd4538b59..1992cc2f8 100644
--- a/libc/sysdeps/i386/fpu/e_logf.S
+++ b/libc/sysdeps/i386/fpu/e_logf.S
@@ -8,14 +8,12 @@
#include <machine/asm.h>
-RCSID("$NetBSD: e_log.S,v 1.4 1995/05/08 23:48:39 jtc Exp $")
-
#ifdef __ELF__
- .section .rodata
+ .section .rodata.cst8,"aM",@progbits,8
#else
.text
#endif
- .align ALIGNARG(4)
+ .p2align 3
ASM_TYPE_DIRECTIVE(one,@object)
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
@@ -28,9 +26,9 @@ limit: .double 0.29
#ifdef PIC
-#define MO(op) op##@GOTOFF(%edx)
+# define MO(op) op##@GOTOFF(%edx)
#else
-#define MO(op) op
+# define MO(op) op
#endif
.text
@@ -65,3 +63,22 @@ ENTRY(__ieee754_logf)
fstp %st(1)
ret
END (__ieee754_logf)
+
+ENTRY(__logf_finite)
+ fldln2 // log(2)
+ flds 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(__logf_finite)