This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] SPARC: fix nearbyint on sNaN input
- From: David Miller <davem at davemloft dot net>
- To: aurelien at aurel32 dot net
- Cc: libc-alpha at sourceware dot org
- Date: Fri, 01 Jul 2016 04:39:24 -0400 (EDT)
- Subject: Re: [PATCH] SPARC: fix nearbyint on sNaN input
- Authentication-results: sourceware.org; auth=none
- References: <1467326157-32579-1-git-send-email-aurelien at aurel32 dot net>
From: Aurelien Jarno <aurelien@aurel32.net>
Date: Fri, 1 Jul 2016 00:35:57 +0200
> nearbyint and nearbyintf should not trigger inexact exceptions, but
> should still trigger an invalid exception for a sNaN input.
>
> The SPARC specific implementations of these functions save the FSR at
> the beginning of the function and restore it at the end to not trigger
> an inexact exception. This however doesn't work for an sNaN input which
> need to trigger an invalid exception. Fix that by adding a fcmp
> instruction using the input value before saving FSR, so that an invalid
> exception is triggered for a sNaN input.
>
> This fixes the math/test-nearbyint-except test on SPARC.
Looks good.