[PATCH] SPARC: fix nearbyint on sNaN input

David Miller davem@davemloft.net
Fri Jul 1 08:40:00 GMT 2016


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.



More information about the Libc-alpha mailing list