path: root/src/math/x86_64
AgeCommit message (Collapse)AuthorLines
2020-03-24math: add x86_64 remquolAlexander Monakov-0/+32
2020-03-24math: move x87-family fmod functions to C with inline asmAlexander Monakov-11/+9
2020-03-24math: move x87-family remainder functions to C with inline asmAlexander Monakov-11/+9
2020-03-24math: move x87-family rint functions to C with inline asmAlexander Monakov-6/+7
2020-03-24math: move x87-family lrint functions to C with inline asmAlexander Monakov-14/+16
2020-03-24math: move x86_64 (l)lrint(f) functions to C with inline asmAlexander Monakov-20/+32
2020-03-24math: move trivial x86-family sqrt functions to C with inline asmAlexander Monakov-13/+21
2020-03-24math: move x87-family fabs functions to C with inline asmAlexander Monakov-6/+7
2020-03-24math: move x86_64 fabs, fabsf to C with inline asmAlexander Monakov-16/+20
2018-10-15x86_64: add single instruction fmaSzabolcs Nagy-0/+46
fma is only available on recent x86_64 cpus and it is much faster than a software fma, so this should be done with a runtime check, however that requires more changes, this patch just adds the code so it can be tested when musl is compiled with -mfma or -mfma4.
2015-04-23fix regression in x86_64 math asm with old binutilsRich Felker-3/+3
the implicit-operand form of fucomip is rejected by binutils 2.19 and perhaps other versions still in use. writing both operands explicitly fixes the issue. there is no change to the resulting output. commit a732e80d33b4fd6f510f7cec4f5573ef5d89bc4e was the source of this regression.
2015-04-18remove potentially PIC-incompatible relocations from x86_64 and x32 asmRich Felker-1/+1
analogous to commit 8ed66ecbcba1dd0f899f22b534aac92a282f42d5 for i386.
2014-11-05math: use fnstsw consistently instead of fstsw in x87 asmSzabolcs Nagy-2/+2
fnstsw does not wait for pending unmasked x87 floating-point exceptions and it is the same as fstsw when all exceptions are masked which is the only environment libc supports.
2014-11-05math: fix x86_64 and x32 asm not to use sahf instructionSzabolcs Nagy-14/+7
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.
2013-09-13fix x86_64 lrintl asm, againRich Felker-2/+2
the underlying problem was not incorrect sign extension (fixed in the previous commit to this file by nsz) but that code that treats "long" as 32-bit was copied blindly from i386 to x86_64. now lrintl is identical to llrintl on x86_64, as it should be.
2013-09-05math: fix expm1l on x86_64 (avoid underflow for large negative x)Szabolcs Nagy-3/+13
copy the fix from i386: return -1 instead of exp2l(x)-1 when x <= -65
2013-09-05math: fix lrintl.s on x86_64 (use movslq to signextend the result)Szabolcs Nagy-1/+1
2013-09-05math: fix exp2l asm on x86 (raise underflow correctly)Szabolcs Nagy-35/+40
there were two problems: * omitted underflow on subnormal results: exp2l(-16383.5) was calculated as sqrt(2)*2^-16384, the last bits of sqrt(2) are zero so the down scaling does not underflow eventhough the result is in subnormal range * spurious underflow for subnormal inputs: exp2l(0x1p-16400) was evaluated as f2xm1(x)+1 and f2xm1 raised underflow (because inexact subnormal result) the first issue is fixed by raising underflow manually if x is in (-32768,-16382] and not integer (x-0x1p63+0x1p63 != x) the second issue is fixed by treating x in (-0x1p64,0x1p64) specially for these fixes the special case handling was completely rewritten
2013-08-16fix build of x86_64 expl assemblyRich Felker-1/+1
apparently this label change was not carried over when adapting the changes from the i386 version.
2013-08-15math: fix x86 expl.s to raise underflow and clean up special case handlingSzabolcs Nagy-22/+15
2012-12-16math: x86_64 version of expl, fixed some comments in the i386 versionSzabolcs Nagy-0/+108
2012-12-16math: move x86_64 exp2l implementation to exp2l.s from expl.sSzabolcs Nagy-85/+76
2012-12-12math: add empty __invtrigl.s to i386 and x86_64Szabolcs Nagy-0/+0
__invtrigl is not needed when acosl, asinl, atanl have asm implementations
2012-08-08math: fix exp.s on i386 and x86_64 so the exception flags are correctnsz-19/+17
exp(inf), exp(-inf), exp(nan) used to raise wrong flags
2012-06-02use fistpll mnemonic instead of fistpq (more widely supported) on x86_64 tooRich Felker-1/+1
this was fixed previously on i386 but the corresponding code on x86_64 was missed.
2012-05-05math: change the formula used for acos.snsz-10/+8
old: 2*atan2(sqrt(1-x),sqrt(1+x)) new: atan2(fabs(sqrt((1-x)*(1+x))),x) improvements: * all edge cases are fixed (sign of zero in downward rounding) * a bit faster (here a single call is about 131ns vs 162ns) * a bit more precise (at most 1ulp error on 1M uniform random samples in [0,1), the old formula gave some 2ulp errors as well)
2012-04-29fix typo in the x86_64 rounding asmRich Felker-4/+4
2012-04-29new math asm (abs/rounding) for x86_64Rich Felker-0/+36
2012-04-04math: fix x86 asin accuracynsz-3/+3
use (1-x)*(1+x) instead of (1-x*x) in asin.s the later can be inaccurate with upward rounding when x is close to 1
2012-03-29math: remove x86 modf asmnsz-27/+0
the int part was wrong when -1 < x <= -0 (+0.0 instead of -0.0) and the size and performace gain of the asm version was negligible
2012-03-22acos.s fix: use the formula acos(x) = atan2(sqrt(1-x),sqrt(1+x))nsz-3/+1
the old formula atan2(1,sqrt((1+x)/(1-x))) was faster but could give nan result at x=1 when the rounding mode is FE_DOWNWARD (so 1-1 == -0 and 2/-0 == -inf), the new formula gives -0 at x=+-1 with downward rounding.
2012-03-20x86_64 math asm, long double functions onlyRich Felker-0/+239
this has not been tested heavily, but it's known to at least assemble and run in basic usage cases. it's nearly identical to the corresponding i386 code, and thus expected to be just as correct or just as incorrect.
2012-03-18assembly optimizations for fmod/remainder functionsRich Felker-0/+22
2012-03-18asm versions of some simple math functions for i386 and x86_64Rich Felker-0/+12
these are functions that have direct fpu approaches to implementation without problematic exception or rounding issues. x86_64 lacks float/double versions because i'm unfamiliar with the necessary sse code for performing these operations.
2012-03-13first commit of the new libm!Rich Felker-0/+5
thanks to the hard work of Szabolcs Nagy (nsz), identifying the best (from correctness and license standpoint) implementations from freebsd and openbsd and cleaning them up! musl should now fully support c99 float and long double math functions, and has near-complete complex math support. tgmath should also work (fully on gcc-compatible compilers, and mostly on any c99 compiler). based largely on commit 0376d44a890fea261506f1fc63833e7a686dca19 from nsz's libm git repo, with some additions (dummy versions of a few missing long double complex functions, etc.) by me. various cleanups still need to be made, including re-adding (if they're correct) some asm functions that were dropped.
2011-06-26type directives for x86_64 math asmRich Felker-0/+2
2011-02-15Port musl to x86-64. One giant commit!Nicholas J. Kain-0/+6