On Mon, Feb 13, 2012 at 3:32 PM, Jakub Jelinek <ja...@redhat.com> wrote: > On Mon, Feb 13, 2012 at 02:48:05PM +0100, Richard Guenther wrote: >> > I think there is some consensus that crlibm is a great place to start >> > for correctly-rounded elementary functions. I think we'd need, or at >> > least greatly appreciate, some help from your team. >> >> I agree. If crlibm can provide a solid basis for a correctly implemented >> set of C99 math functions then use it. It would be nice to have a >> GCC linking exception on it though, otherwise static linking or >> re-optimizing with LTO will be difficult. > > Last time I've looked, crlibm even for double provides only a subset of > functions you are looking for for the math library, so you need to take > the various *signbit*/*scal*/fpclassify*/nexttoward*/nextafter*/rint*/round* > etc. from some other source (glibc, something else).
For these basic routines we could fall back to the soft-fp routines (though I expect most targets expand those inline anyway). > Furthermore, crlibm_init changes the i?86/x86_64 rounding mode globally, > that is not appropriate for a general purpose math library, there you either > need to cope with extended precision, or rely on SSE/SSE2 for float/double, > or change the rounding mode dynamically on entry and reset back to previous > state in all functions that rely on it. True, we need to deal with FP state anyway for the different rounding modes and -f[no-]rounding-math optimization. Richard. > Jakub