aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/i386/fpu/s_log2l.S
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/i386/fpu/s_log2l.S')
-rw-r--r--sysdeps/i386/fpu/s_log2l.S11
1 files changed, 10 insertions, 1 deletions
diff --git a/sysdeps/i386/fpu/s_log2l.S b/sysdeps/i386/fpu/s_log2l.S
index 184981c4bb..7b645d57ab 100644
--- a/sysdeps/i386/fpu/s_log2l.S
+++ b/sysdeps/i386/fpu/s_log2l.S
@@ -40,8 +40,12 @@ ENTRY(__log2l)
#endif
fldl MO(one)
fldt 4(%esp) // x : 1
+ fxam
+ fnstsw
fld %st // x : x : 1
- fsub %st(2), %st // x-1 : x : 1
+ sahf
+ jc 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
fabs // |x-1| : x-1 : x : 1
fcompl MO(limit) // x-1 : x : 1
@@ -55,5 +59,10 @@ ENTRY(__log2l)
2: fstp %st(0) // x : 1
fyl2x // log(x)
ret
+
+3: jp 4b // in case x is ħInf
+ fstp %st(1)
+ fstp %st(1)
+ ret
END (__log2l)
weak_alias (__log2l, log2l)