<feed xmlns='http://www.w3.org/2005/Atom'>
<title>musl/src/fenv/i386, branch master</title>
<subtitle>musl - an implementation of the standard library for Linux-based systems</subtitle>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/'/>
<entry>
<title>make arch __fesetround backends hidden</title>
<updated>2018-09-12T18:34:32+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2018-09-10T19:51:44+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=039f1b3c564667ab6fc9955bd892c2e527eb80b0'/>
<id>039f1b3c564667ab6fc9955bd892c2e527eb80b0</id>
<content type='text'>
these are not public interfaces and do not match the public function,
but delegate argument checking to it.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
these are not public interfaces and do not match the public function,
but delegate argument checking to it.
</pre>
</div>
</content>
</entry>
<entry>
<title>fix fesetenv(FE_DFL_ENV) on i386</title>
<updated>2014-02-09T17:19:03+00:00</updated>
<author>
<name>Szabolcs Nagy</name>
<email>nsz@port70.net</email>
</author>
<published>2014-02-09T17:19:03+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=929729d4307e28d7023fbee2b727a56fc34b744c'/>
<id>929729d4307e28d7023fbee2b727a56fc34b744c</id>
<content type='text'>
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).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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).
</pre>
</div>
</content>
</entry>
<entry>
<title>fenv: fix i386 fesetround for sse</title>
<updated>2013-10-28T20:33:54+00:00</updated>
<author>
<name>Szabolcs Nagy</name>
<email>nsz@port70.net</email>
</author>
<published>2013-10-28T20:33:54+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=7e01b8f09b6d50991472e0198c4959b085884dec'/>
<id>7e01b8f09b6d50991472e0198c4959b085884dec</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>fix fenv exception functions to mask their argument</title>
<updated>2013-08-18T20:08:18+00:00</updated>
<author>
<name>Szabolcs Nagy</name>
<email>nsz@port70.net</email>
</author>
<published>2013-08-18T20:08:18+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=a6b0170a7f51fdea9beec57ae794221290af232b'/>
<id>a6b0170a7f51fdea9beec57ae794221290af232b</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>optimize x86 feclearexcept: only use save/restore x87 fenv if needed</title>
<updated>2013-08-18T16:27:21+00:00</updated>
<author>
<name>Szabolcs Nagy</name>
<email>nsz@port70.net</email>
</author>
<published>2013-08-18T15:34:07+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=d8764bf84022397ff9d22310f78fcd78d801e2bf'/>
<id>d8764bf84022397ff9d22310f78fcd78d801e2bf</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>add sse fenv support on i386 through hwcap</title>
<updated>2013-08-18T16:27:20+00:00</updated>
<author>
<name>Szabolcs Nagy</name>
<email>nsz@port70.net</email>
</author>
<published>2013-08-17T02:40:44+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=ebc10fa17634a6ddb87a3aedd71b7d9617d12c19'/>
<id>ebc10fa17634a6ddb87a3aedd71b7d9617d12c19</id>
<content type='text'>
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)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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)
</pre>
</div>
</content>
</entry>
<entry>
<title>fix i386 fesetenv: FE_DFL_ENV is (fenv_t*)-1 not 0</title>
<updated>2013-08-18T16:27:20+00:00</updated>
<author>
<name>Szabolcs Nagy</name>
<email>nsz@port70.net</email>
</author>
<published>2013-08-17T02:37:08+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=d6841499109fc397cd3a57a726304fec9b08f510'/>
<id>d6841499109fc397cd3a57a726304fec9b08f510</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>optimize x86 feclearexcept</title>
<updated>2012-03-17T23:29:00+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2012-03-17T23:29:00+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=316e024f63af0d0d2bb0df3dfce2620f4be827d1'/>
<id>316e024f63af0d0d2bb0df3dfce2620f4be827d1</id>
<content type='text'>
if all exception flags will be cleared, we can avoid the expensive
store/reload of the environment and just use the fnclex instruction.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
if all exception flags will be cleared, we can avoid the expensive
store/reload of the environment and just use the fnclex instruction.
</pre>
</div>
</content>
</entry>
<entry>
<title>minor 387 fenv optimizations</title>
<updated>2012-03-17T21:49:10+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2012-03-17T21:49:10+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=d5e576c7527c42b376d20ef38669ffc2a78b0a76'/>
<id>d5e576c7527c42b376d20ef38669ffc2a78b0a76</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>fix i386 fegetround and make fesetround faster</title>
<updated>2012-03-17T12:46:15+00:00</updated>
<author>
<name>nsz</name>
<email>nsz@port70.net</email>
</author>
<published>2012-03-17T12:46:15+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=88cfaf8a142a8c57beccb89398a6421c4bbf121a'/>
<id>88cfaf8a142a8c57beccb89398a6421c4bbf121a</id>
<content type='text'>
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).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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).
</pre>
</div>
</content>
</entry>
</feed>
