summaryrefslogtreecommitdiff
path: root/libc/sysdeps/i386/fpu/s_expm1.S
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/i386/fpu/s_expm1.S')
-rw-r--r--libc/sysdeps/i386/fpu/s_expm1.S13
1 files changed, 12 insertions, 1 deletions
diff --git a/libc/sysdeps/i386/fpu/s_expm1.S b/libc/sysdeps/i386/fpu/s_expm1.S
index 91617eb74..36f8214c0 100644
--- a/libc/sysdeps/i386/fpu/s_expm1.S
+++ b/libc/sysdeps/i386/fpu/s_expm1.S
@@ -1,5 +1,5 @@
/* ix87 specific implementation of exp(x)-1.
- Copyright (C) 1996-2013 Free Software Foundation, Inc.
+ Copyright (C) 1996-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
Based on code by John C. Bowman <bowman@ipp-garching.mpg.de>.
@@ -78,7 +78,18 @@ ENTRY(__expm1)
5: fldt MO(l2e) // log2(e) : x
fmulp // log2(e)*x
fld %st // log2(e)*x : log2(e)*x
+ // Set round-to-nearest temporarily.
+ subl $8, %esp
+ cfi_adjust_cfa_offset (8)
+ fstcw 4(%esp)
+ movl $0xf3ff, %ecx
+ andl 4(%esp), %ecx
+ movl %ecx, (%esp)
+ fldcw (%esp)
frndint // int(log2(e)*x) : log2(e)*x
+ fldcw 4(%esp)
+ addl $8, %esp
+ cfi_adjust_cfa_offset (-8)
fsubr %st, %st(1) // int(log2(e)*x) : fract(log2(e)*x)
fxch // fract(log2(e)*x) : int(log2(e)*x)
f2xm1 // 2^fract(log2(e)*x)-1 : int(log2(e)*x)