This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] (1/3) Add back libgcc-math
On Thu, 16 Nov 2006, Joseph S. Myers wrote:
> On Thu, 16 Nov 2006, Richard Guenther wrote:
> > This patch adds back libgcc-math populated with vectorized routines
> > for sin, cos, log, pow, and sqrt for x86_64 as contributed by AMD.
> How has the correctness of these implementations been tested? (One
> approach might be to create a script to process glibc's libm-test.inc -
> which is designed to be processed by scripts - to put tests for the
> relevant functions in a form suitable for the GCC testsuite. We certainly
> want execution tests in the GCC testsuite if possible, whether
> automatically derived from the glibc testsuite or otherwise. Automatic
> processing has the advantage that when glibc bugs are fixed and tests
> added we can easily see if these implementations share those bugs or not.)
I can query AMD on this. But those functions are supposed to be
called with -funsafe-math-optimizations only as they violate certain
aspects of IEEE/C, like they cannot consistently throw exceptions
or raise FP status bits (they get vector input after all, and compute
two or four results at the same time). Also at least the exp variant
truncates denormals to zero and the cosf variant reads "Denormals may
produce unexpected results". Most of the routines state that they
produce less than 1ulp of error, but I have not verified this myself
but trust AMD here.
Algorithmically they are all based on a (supposedly correct) C
implementation for scalar inputs.
I don't know if it is possible to use the glibc tests in this
circumstances without major hassle, but I agree having some correctness
tests is useful.
Richard Guenther <firstname.lastname@example.org>
Novell / SUSE Labs