diff options
Diffstat (limited to 'lib/libm')
-rw-r--r-- | lib/libm/arch/i387/e_exp.S | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/lib/libm/arch/i387/e_exp.S b/lib/libm/arch/i387/e_exp.S index 8c41ce09dd5..87db828e639 100644 --- a/lib/libm/arch/i387/e_exp.S +++ b/lib/libm/arch/i387/e_exp.S @@ -5,19 +5,34 @@ #include <machine/asm.h> -RCSID("$NetBSD: e_exp.S,v 1.4 1995/05/08 23:47:04 jtc Exp $") +RCSID("$NetBSD: e_exp.S,v 1.4.6.1 1996/07/03 19:27:36 jtc Exp $") /* e^x = 2^(x * log2(e)) */ ENTRY(__ieee754_exp) - fldl 4(%esp) + pushl %ebp + movl %esp,%ebp + subl $8,%esp + + fstcw -12(%ebp) /* store fpu control word */ + movw -12(%ebp),%dx + orw $0x0180,%dx + movw %dx,-16(%ebp) + fldcw -16(%ebp) /* load modfied control word */ + + fldl 8(%ebp) fldl2e fmulp /* x * log2(e) */ fstl %st(1) frndint /* int(x * log2(e)) */ - fstl %st(2) - fsubrp /* fract(x * log2(e)) */ + fxch %st(1) + fsub %st(1),%st /* fract(x * log2(e)) */ f2xm1 /* 2^(fract(x * log2(e))) - 1 */ fld1 faddp /* 2^(fract(x * log2(e))) */ fscale /* e^x */ + fstpl %st(1) + + fldcw -12(%ebp) /* restore original control word */ + + leave ret |