summaryrefslogtreecommitdiff
path: root/src/fenv
AgeCommit message (Collapse)AuthorLines
2014-02-27rename superh port to "sh" for consistencyRich Felker-0/+0
linux, gcc, etc. all use "sh" as the name for the superh arch. there was already some inconsistency internally in musl: the dynamic linker was searching for "ld-musl-sh.path" as its path file despite its own name being "ld-musl-superh.so.1". there was some sentiment in both directions as to how to resolve the inconsistency, but overall "sh" was favored.
2014-02-24add missing sub files for mipsel-sf to use softfloat codeRich Felker-0/+1
the build system has no automatic way to know this code applies to both big (default) and little endian variants, so explicit .sub files are needed.
2014-02-24mips: add mips-sf subarch support (soft-float)Szabolcs Nagy-0/+1
Userspace emulated floating-point (gcc -msoft-float) is not compatible with the default mips abi (assumes an FPU or in kernel emulation of it). Soft vs hard float abi should not be mixed, __mips_soft_float is checked in musl's configure script and there is no runtime check. The -sf subarch does not save/restore floating-point registers in setjmp/longjmp and only provides dummy fenv implementation.
2014-02-23superh portBobby Bingham-0/+74
2014-02-23x32 port (diff against vanilla x86_64)rofl0r-26/+26
2014-02-23import vanilla x86_64 code as x32rofl0r-0/+97
2014-02-09fix fesetenv(FE_DFL_ENV) on x86_64 (see previous commit)Szabolcs Nagy-1/+1
2014-02-09fix fesetenv(FE_DFL_ENV) on i386Szabolcs Nagy-1/+1
the default fenv was not set up properly, in particular the tag word that indicates the contents of the x87 registers was set to 0 (used) instead of 0xffff (empty) this could cause random crashes after setting the default fenv because it corrupted the fpu stack and then any float computation gives NaN result breaking the program logic (usually after a float to integer conversion).
2013-10-28fenv: fix i386 fesetround for sseSzabolcs Nagy-1/+1
i386 fenv code checks __hwcap for sse support, but in fesetround the sse code was unconditionally jumped over after the test so the sse rounding mode was never set.
2013-08-27fix invalid instruction mnemonics in powerpc fenv asmRich Felker-3/+3
there is no non-dot version of the andis instruction, but there's no harm in updating the flags anyway, so just use the dot version.
2013-08-18fix fenv exception functions to mask their argumentSzabolcs Nagy-18/+55
fesetround.c is a wrapper to do the arch independent argument check (on archs where rounding mode is not stored in 2 bits __fesetround still has to check its arguments) on powerpc fe*except functions do not accept the extra invalid flags of its fpscr register the useless FENV_ACCESS pragma was removed from feupdateenv
2013-08-18optimize x86 feclearexcept: only use save/restore x87 fenv if neededSzabolcs Nagy-27/+38
the x87 exception summary (ES) and stack fault (SF) flags may be spuriously cleared by feclearexcept using the fnclex instruction, but these flags are not observable through libc hence maintaining their state is not critical.
2013-08-18add sse fenv support on i386 through hwcapSzabolcs Nagy-9/+61
the sse and x87 rounding modes should be always the same, the visible exception flags are the bitwise or of the two fenv states (so it's enough to query the rounding mode or raise exceptions on one fenv)
2013-08-18fix i386 fesetenv: FE_DFL_ENV is (fenv_t*)-1 not 0Szabolcs Nagy-2/+2
2013-08-16support floating point environment (fenv) on armhf (hard float) subarchsRich Felker-0/+62
patch by nsz. I've tested it on an armhf machine and it seems to be working correctly.
2012-11-18fenv support for ppc, untestedRich Felker-0/+120
based on code sent to the mailing list by nsz, with minor changes.
2012-11-18fix feholdexcept -- it needs to clear exceptions after saving environmentRich Felker-0/+1
2012-11-14fenv: return FE_TONEAREST in dummy fegetroundSzabolcs Nagy-1/+1
2012-11-13math: use '#pragma STDC FENV_ACCESS ON' when fenv is accessedSzabolcs Nagy-0/+1
2012-10-18floating point environment/exceptions support for mipsRich Felker-0/+60
2012-03-17try fixing/optimizing x86_64 fenv exception codeRich Felker-18/+23
untested; may need followup-fixes.
2012-03-17optimize x86 feclearexceptRich Felker-16/+20
if all exception flags will be cleared, we can avoid the expensive store/reload of the environment and just use the fnclex instruction.
2012-03-17fix x86_64 fe[gs]etround, analogous to nsz's x86 changesRich Felker-8/+9
2012-03-17minor 387 fenv optimizationsRich Felker-6/+5
2012-03-17fix i386 fegetround and make fesetround fasternsz-10/+10
Note that the new fesetround has slightly different semantics: Storing the floating-point environment with fnstenv makes the next fldenv (or fldcw) "non-signaling", so unmasked and pending exceptions does not invoke the exception handler. (These are rare since exceptions are handled immediately and by default all exceptions are masked anyway. But if one manually unmasks an exception in the control word then either sets the corresponding exception flag in the status word or the execution of an exception raising floating-point operation gets interrupted then it may happen). So the old implementation did not trap in some rare cases where the new implementation traps. However POSIX does not specify anything like the x87 exception handling traps and the fnstenv/fldenv pair is significantly slower than the fnstcw/fldcw pair (new code is about 5x faster here and it's dominated by the function call overhead).
2011-06-28use type directives for fenv asm functionsRich Felker-0/+14
2011-06-13x86_64 fenv support (untested; at least known to build successfully)Rich Felker-0/+88
2011-06-13fix fesetround - it was writing to status word instead of control wordRich Felker-3/+8
2011-06-12floating point environment, untestedRich Felker-0/+144
at present the i386 code does not support sse floating point, which is not part of the standard i386 abi. while it may be desirable to support it later, doing so will reduce performance and require some tricks to probe if sse support is present. this first commit is i386-only, but it should be trivial to port the asm to x86_64.