summaryrefslogtreecommitdiff
path: root/sysdeps/i386/fpu/e_exp.S
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-10-15 20:22:59 -0400
committerUlrich Drepper <drepper@gmail.com>2011-10-15 20:22:59 -0400
commitbcf01e6d800e837622ddbc851b42b55fa99e5636 (patch)
tree5df0ae9971331105fe53de872895abb68d8276a5 /sysdeps/i386/fpu/e_exp.S
parentba1a0d5938b53454a249d679ab90baf541cd91ad (diff)
downloadglibc-bcf01e6d800e837622ddbc851b42b55fa99e5636.tar.gz
Optimize exp
Add __exp*_finite optimizations and rewrite some wrappers.
Diffstat (limited to 'sysdeps/i386/fpu/e_exp.S')
-rw-r--r--sysdeps/i386/fpu/e_exp.S17
1 files changed, 16 insertions, 1 deletions
diff --git a/sysdeps/i386/fpu/e_exp.S b/sysdeps/i386/fpu/e_exp.S
index 4a75fa1d1c..2c331d9ed6 100644
--- a/sysdeps/i386/fpu/e_exp.S
+++ b/sysdeps/i386/fpu/e_exp.S
@@ -5,7 +5,6 @@
#include <machine/asm.h>
-RCSID("$NetBSD: e_exp.S,v 1.7 1996/07/03 17:31:28 jtc Exp $")
/* e^x = 2^(x * log2(e)) */
ENTRY(__ieee754_exp)
@@ -39,3 +38,19 @@ ENTRY(__ieee754_exp)
fldz /* Set result to 0. */
2: ret
END (__ieee754_exp)
+
+
+ENTRY(__exp_finite)
+ fldl2e
+ fmull 4(%esp) /* x * log2(e) */
+ fld %st
+ frndint /* int(x * log2(e)) */
+ fsubr %st,%st(1) /* fract(x * log2(e)) */
+ fxch
+ f2xm1 /* 2^(fract(x * log2(e))) - 1 */
+ fld1
+ faddp /* 2^(fract(x * log2(e))) */
+ fscale /* e^x */
+ fstp %st(1)
+ ret
+END(__exp_finite)