[PATCH] tile: create new math-tests.h header
Chris Metcalf
cmetcalf@mellanox.com
Thu Nov 17 21:43:00 GMT 2016
On 11/16/2016 5:51 PM, Joseph Myers wrote:
> On Wed, 16 Nov 2016, Chris Metcalf wrote:
>
>> The header makes tile use the new mechanisms for suppressing
>> exception and rounding support (the ROUNDING_TESTS_xxx() and
>> EXCEPTION_TESTS_xxx macros). More importantly, it also now sets
>> SNAN_TESTS_PRESERVE_PAYLOAD to 0, since the tile soft float does
>> not preserve NaN payloads.
> All the tile sfp-machine.h files in libgcc seem to define _FP_KEEPNANFRACP
> to 1, so not preserving NaN payloads seems odd here.
So perhaps it's some kind of testing bug, or I'm otherwise
confused. The following small program seems to suggest
that the payload is copied in canonicalize. I built it naively just
by compiling it with my system headers but linking statically
against "libc.a math/libm.a" in the glibc build tree. It prints
out "0 nan nan 1 1" when run.
#include <stdio.h>
#include <math.h>
double getpayload (const double *x);
int canonicalize (double *__cx, const double *__x);
int main()
{
const double nan = __builtin_nans("0x1");
double nan_payload = getpayload(&nan);
double cnan;
int rc = canonicalize(&cnan, &nan);
double cnan_payload = getpayload(&nan);
printf("%d %a %a %g %g\n", rc, nan, cnan, nan_payload, cnan_payload);
return 0;
}
--
Chris Metcalf, Mellanox Technologies
http://www.mellanox.com
More information about the Libc-alpha
mailing list