Commit Graph

14 Commits

Author SHA1 Message Date
Rich Felker 75c450cff3 fenv support for ppc, untested
based on code sent to the mailing list by nsz, with minor changes.
2012-11-18 16:31:14 -05:00
Rich Felker 0b52bf5c78 fix feholdexcept -- it needs to clear exceptions after saving environment 2012-11-18 16:10:20 -05:00
Szabolcs Nagy 68847ecd3a fenv: return FE_TONEAREST in dummy fegetround 2012-11-14 09:27:54 +01:00
Szabolcs Nagy 033a9d6ad2 math: use '#pragma STDC FENV_ACCESS ON' when fenv is accessed 2012-11-13 13:34:45 +01:00
Rich Felker f321de9e0a floating point environment/exceptions support for mips 2012-10-18 20:19:53 -04:00
Rich Felker b60053e762 try fixing/optimizing x86_64 fenv exception code
untested; may need followup-fixes.
2012-03-17 20:10:02 -04:00
Rich Felker 316e024f63 optimize x86 feclearexcept
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-17 19:29:00 -04:00
Rich Felker 9cb6878e74 fix x86_64 fe[gs]etround, analogous to nsz's x86 changes 2012-03-17 18:02:20 -04:00
Rich Felker d5e576c752 minor 387 fenv optimizations 2012-03-17 17:49:10 -04:00
nsz 88cfaf8a14 fix i386 fegetround and make fesetround faster
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).
2012-03-17 13:46:15 +01:00
Rich Felker e411827960 use type directives for fenv asm functions 2011-06-28 14:41:41 -04:00
Rich Felker 773b0fe447 x86_64 fenv support (untested; at least known to build successfully) 2011-06-13 13:37:43 -04:00
Rich Felker 52cf24a0f4 fix fesetround - it was writing to status word instead of control word 2011-06-13 13:37:16 -04:00
Rich Felker b09b78905b floating point environment, untested
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.
2011-06-12 15:58:15 -04:00