[PATCH] PPC fenv fixes.

Steven Munroe munroesj@us.ibm.com
Tue Mar 27 15:53:00 GMT 2007


Steven Munroe wrote:
> Jakub Jelinek wrote:
>   
>> Hi!
>>
>> feholdexcept is supposed to clear the sticky exception bits:
>> "The feholdexcept function saves the current floating-point environment in the object
>> pointed to by envp, clears the floating-point status flags, and then installs a non-stop
>> (continue on floating-point exceptions) mode, if available, for all floating-point
>> exceptions."
>> and
>> "A floating-point status flag is a system variable whose value is set
>> (but never cleared) when a floating-point exception is raised, which occurs as a side effect
>> of exceptional floating-point arithmetic to provide auxiliary information."
>>
>> Several feholdexcept implementations didn't handle this right.
>> Also, e.g. feupdateenv was a stub on x86_64 eventhough it is IMHO easily
>> implementable and other arches had bugs in it too (e.g. ia64 would rise
>> wrong exceptions and always return a failure).
>> I added a new testcase for feholdexcept/feupdateenv (hopefully I haven't
>> misinterpreted the standard) and I believe other arches (ppc*, s390*, ...)
>> will need some care too.
>>   
>>     
>
> powerpc32 and powerpc64 both show two failures with the new test-fenv:
>
> Test: feholdexcept_tests FE_DIVBYZERO|FE_INVALID test
>   Fail: Exception "DIVBYZERO" is not set
>   Pass: Exception "INVALID" is set
>   Pass: Exception "INEXACT" is not set
>   Pass: Exception "UNDERFLOW" is not set
>   Pass: Exception "OVERFLOW" is not set
>
> and
>
> Test: feholdexcept_tests FE_INEXACT|FE_INVALID test
>   Pass: Exception "DIVBYZERO" is not set
>   Fail: Exception "INVALID" is not set
>   Pass: Exception "INEXACT" is set
>   Pass: Exception "UNDERFLOW" is not set
>   Pass: Exception "OVERFLOW" is not set
>
> We will look into this.
>   
feupdateenv was not merging pending and current exceptions correctly and
caused 2 failures with the new feholdexcept tests. The attached patch
fixes feupdateenv for ppc32/ppc64.


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ppc-feupdateenv-20070327.txt
URL: <http://sourceware.org/pipermail/libc-hacker/attachments/20070327/65356ccd/attachment.txt>


More information about the Libc-hacker mailing list