Fwd: weird optimization in sin+cos, x86 backend

Janne Blomqvist blomqvist.janne@gmail.com
Mon Feb 13 09:41:00 GMT 2012


Richard Guenther <richard dot guenther at gmail dot com> wrote:
>
> I don't buy the argument that inlining math routines (apart from those we already handle) would improve performance. What will improve performance is to have separate entry points to the routines to skip errno handling, NaN/Inf checking or rounding mode selection when certain compilation flags are set. That as well as a more sane calling convention for, for example sincos, or in general on x86_64 (have at least _some_ callee-saved XMM registers).
>

If one were to create a new libm, why not dispense with the errno
stuff altogether, and make -fno-math-errno the default, at least in
c99/c++11 modes (and set the math_errhandling macro properly). Some
quick googling suggests that libm's which don't set errno are not that
uncommon, e.g.

https://lists.gnu.org/archive/html/bug-gnulib/2011-11/msg00069.html

http://docs.oracle.com/cd/E19422-01/819-3693/ncg_compliance.html

http://www.uta.edu/faculty/rcli/papers/FP_White_Paper_v2.pdf

https://www-304.ibm.com/support/docview.wss?uid=swg27005375

http://www.cz.freebsd.org/pub/FreeBSD-cvs/gnats/standards/56906

Wrappers setting errno for compatibility with C89/C++98 and older
POSIX standards would probably still be desirable, though.

--
Janne Blomqvist



--
Janne Blomqvist



More information about the Gcc mailing list