diff options
author | Szabolcs Nagy <nsz@port70.net> | 2014-11-05 21:40:29 +0100 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2015-03-30 01:41:32 -0400 |
commit | 8c245bf2725f3171ee8f58dab7169e5d682de026 (patch) | |
tree | ae92d5d0536aa3b15adb96d62b4487488998e5a8 /src/math/x32/exp2l.s | |
parent | e48fff8d338d85616dc650cc8b4dd5ae00083da1 (diff) | |
download | musl-8c245bf2725f3171ee8f58dab7169e5d682de026.tar.gz musl-8c245bf2725f3171ee8f58dab7169e5d682de026.tar.bz2 musl-8c245bf2725f3171ee8f58dab7169e5d682de026.tar.xz musl-8c245bf2725f3171ee8f58dab7169e5d682de026.zip |
math: fix x86_64 and x32 asm not to use sahf instruction
Some early x86_64 cpus (released before 2006) did not support sahf/lahf
instructions so they should be avoided (intel manual says they are only
supported if CPUID.80000001H:ECX.LAHF-SAHF[bit 0] = 1).
The workaround simplifies exp2l and expm1l because fucomip can be
used instead of the fucomp;fnstsw;sahf sequence copied from i386.
In fmodl and remainderl sahf is replaced by a simple bit test.
(cherry picked from commit a732e80d33b4fd6f510f7cec4f5573ef5d89bc4e)
Diffstat (limited to 'src/math/x32/exp2l.s')
-rw-r--r-- | src/math/x32/exp2l.s | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/math/x32/exp2l.s b/src/math/x32/exp2l.s index d9f4d6ed..dfb2bc7c 100644 --- a/src/math/x32/exp2l.s +++ b/src/math/x32/exp2l.s @@ -6,9 +6,7 @@ expm1l: fmulp movl $0xc2820000,-4(%esp) flds -4(%esp) - fucomp %st(1) - fnstsw %ax - sahf + fucomip %st(1) fld1 jb 1f # x*log2e <= -65, return -1 without underflow @@ -17,11 +15,8 @@ expm1l: ret 1: fld %st(1) fabs - fucom %st(1) - fnstsw %ax + fucomip %st(1) fstp %st(0) - fstp %st(0) - sahf ja 1f f2xm1 ret @@ -53,9 +48,7 @@ exp2l: fld %st(1) fsub %st(1) faddp - fucomp %st(1) - fnstsw - sahf + fucomip %st(1) je 2f # x - 0x1p63 + 0x1p63 == x movl $1,(%esp) flds (%esp) # 0x1p-149 |