summaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-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
-rw-r--r--sysdeps/x86_64/fpu/e_log10l.S5
-rw-r--r--sysdeps/x86_64/fpu/e_log2l.S5
-rw-r--r--sysdeps/x86_64/fpu/e_logl.S12
-rw-r--r--sysdeps/x86_64/fpu/s_log1pl.S5
7 files changed, 50 insertions, 10 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)
diff --git a/sysdeps/x86_64/fpu/e_log10l.S b/sysdeps/x86_64/fpu/e_log10l.S
index b4343bef45..633234b744 100644
--- a/sysdeps/x86_64/fpu/e_log10l.S
+++ b/sysdeps/x86_64/fpu/e_log10l.S
@@ -42,7 +42,7 @@ ENTRY(__ieee754_log10l)
fxam
fnstsw
fld %st // x : x : log10(2)
- andb $1,%ah
+ testb $1, %ah
jnz 3f // in case x is NaN or ħInf
4: fsubl MO(one) // x-1 : x : log10(2)
fld %st // x-1 : x-1 : x : log10(2)
@@ -59,7 +59,8 @@ ENTRY(__ieee754_log10l)
fyl2x // log10(x)
ret
-3: jp 4b // in case x is ħInf
+3: testb $4, %ah
+ jnz 4b // in case x is ħInf
fstp %st(1)
fstp %st(1)
ret
diff --git a/sysdeps/x86_64/fpu/e_log2l.S b/sysdeps/x86_64/fpu/e_log2l.S
index 7a89b94d9f..f04d30a05a 100644
--- a/sysdeps/x86_64/fpu/e_log2l.S
+++ b/sysdeps/x86_64/fpu/e_log2l.S
@@ -39,7 +39,7 @@ ENTRY(__ieee754_log2l)
fxam
fnstsw
fld %st // x : x : 1
- andb $1,%ah
+ testb $1, %ah
jnz 3f // in case x is NaN or ħInf
4: fsub %st(2), %st // x-1 : x : 1
fld %st // x-1 : x-1 : x : 1
@@ -56,7 +56,8 @@ ENTRY(__ieee754_log2l)
fyl2x // log(x)
ret
-3: jp 4b // in case x is ħInf
+3: testb $4, %ah
+ jnz 4b // in case x is ħInf
fstp %st(1)
fstp %st(1)
ret
diff --git a/sysdeps/x86_64/fpu/e_logl.S b/sysdeps/x86_64/fpu/e_logl.S
index a0bed663c8..2ba91eedfd 100644
--- a/sysdeps/x86_64/fpu/e_logl.S
+++ b/sysdeps/x86_64/fpu/e_logl.S
@@ -38,8 +38,12 @@ limit: .double 0.29
ENTRY(__ieee754_logl)
fldln2 // log(2)
fldt 8(%rsp) // x : log(2)
+ fxam
+ fnstsw
fld %st // x : x : log(2)
- fsubl MO(one) // x-1 : x : log(2)
+ testb $1, %ah
+ jnz 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)
@@ -53,4 +57,10 @@ ENTRY(__ieee754_logl)
2: fstp %st(0) // x : log(2)
fyl2x // log(x)
ret
+
+3: testb $4, %ah
+ jnz 4b // in case x is +-Inf
+ fstp %st(1)
+ fstp %st(1)
+ ret
END (__ieee754_logl)
diff --git a/sysdeps/x86_64/fpu/s_log1pl.S b/sysdeps/x86_64/fpu/s_log1pl.S
index 7fbd0e5aaa..ac2bd22a4f 100644
--- a/sysdeps/x86_64/fpu/s_log1pl.S
+++ b/sysdeps/x86_64/fpu/s_log1pl.S
@@ -45,7 +45,7 @@ ENTRY(__log1pl)
fxam
fnstsw
fld %st
- andb $1,%ah
+ testb $1, %ah
jnz 3f // in case x is NaN or ħInf
4:
fabs
@@ -62,7 +62,8 @@ ENTRY(__log1pl)
2: fyl2xp1
ret
-3: jp 4b // in case x is ħInf
+3: testb $4, %ah
+ jnz 4b // in case x is ħInf
fstp %st(1)
fstp %st(1)
ret