about summary refs log tree commit diff
path: root/src/math/x86_64
Commit message (Collapse)AuthorAgeFilesLines
* fix regression in x86_64 math asm with old binutilsRich Felker2015-04-231-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.
* remove potentially PIC-incompatible relocations from x86_64 and x32 asmRich Felker2015-04-181-1/+1
| | | | analogous to commit 8ed66ecbcba1dd0f899f22b534aac92a282f42d5 for i386.
* math: use fnstsw consistently instead of fstsw in x87 asmSzabolcs Nagy2014-11-052-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.
* math: fix x86_64 and x32 asm not to use sahf instructionSzabolcs Nagy2014-11-053-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.
* fix x86_64 lrintl asm, againRich Felker2013-09-131-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.
* math: fix expm1l on x86_64 (avoid underflow for large negative x)Szabolcs Nagy2013-09-053-3/+13
| | | | copy the fix from i386: return -1 instead of exp2l(x)-1 when x <= -65
* math: fix lrintl.s on x86_64 (use movslq to signextend the result)Szabolcs Nagy2013-09-051-1/+1
|
* math: fix exp2l asm on x86 (raise underflow correctly)Szabolcs Nagy2013-09-051-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
* fix build of x86_64 expl assemblyRich Felker2013-08-161-1/+1
| | | | | apparently this label change was not carried over when adapting the changes from the i386 version.
* math: fix x86 expl.s to raise underflow and clean up special case handlingSzabolcs Nagy2013-08-151-22/+15
|
* math: x86_64 version of expl, fixed some comments in the i386 versionSzabolcs Nagy2012-12-161-0/+108
|
* math: move x86_64 exp2l implementation to exp2l.s from expl.sSzabolcs Nagy2012-12-163-85/+76
|
* math: add empty __invtrigl.s to i386 and x86_64Szabolcs Nagy2012-12-121-0/+0
| | | | | __invtrigl is not needed when acosl, asinl, atanl have asm implementations
* math: fix exp.s on i386 and x86_64 so the exception flags are correctnsz2012-08-081-19/+17
| | | | exp(inf), exp(-inf), exp(nan) used to raise wrong flags
* use fistpll mnemonic instead of fistpq (more widely supported) on x86_64 tooRich Felker2012-06-021-1/+1
| | | | | this was fixed previously on i386 but the corresponding code on x86_64 was missed.
* math: change the formula used for acos.snsz2012-05-051-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)
* fix typo in the x86_64 rounding asmRich Felker2012-04-294-4/+4
|
* new math asm (abs/rounding) for x86_64Rich Felker2012-04-296-0/+36
| | | | untested
* math: fix x86 asin accuracynsz2012-04-041-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
* math: remove x86 modf asmnsz2012-03-291-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
* acos.s fix: use the formula acos(x) = atan2(sqrt(1-x),sqrt(1+x))nsz2012-03-221-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.
* x86_64 math asm, long double functions onlyRich Felker2012-03-2017-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.
* assembly optimizations for fmod/remainder functionsRich Felker2012-03-182-0/+22
|
* asm versions of some simple math functions for i386 and x86_64Rich Felker2012-03-182-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.
* first commit of the new libm!Rich Felker2012-03-133-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.
* type directives for x86_64 math asmRich Felker2011-06-262-0/+2
|
* Port musl to x86-64. One giant commit!Nicholas J. Kain2011-02-152-0/+6