[PATCH 3/4 v2] [SH/SH4]: Set fpcsr register which read again

Thomas Schwinge thomas@codesourcery.com
Tue May 22 18:38:00 GMT 2012


Hi!

On Thu,  5 Apr 2012 10:37:48 +0900, Nobuhiro Iwamatsu <iwamatsu@nigauri.org> wrote:
> 	2012-04-04  Nobuhiro Iwamatsu  <iwamatsu@nigauri.org>
> 
> 	* sysdeps/sh/sh4/fpu/fegetenv.c (fegetenv): Set fpscr register which
> 	read again.
> 	* sysdeps/sh/sh4/fpu/ftestexcept.c: Likewise.

> diff --git a/sysdeps/sh/sh4/fpu/fegetenv.c b/sysdeps/sh/sh4/fpu/fegetenv.c
> index 68687dc..49e499f 100644
> --- a/sysdeps/sh/sh4/fpu/fegetenv.c
> +++ b/sysdeps/sh/sh4/fpu/fegetenv.c
> @@ -24,6 +24,10 @@ fegetenv (fenv_t *envp)
>  {
>    unsigned long int temp;
>    _FPU_GETCW (temp);
> +  /* When read fpscr, this was initialized.
> +	 We need to rewrite value of temp. */
> +  _FPU_SETCW (temp);
> +
>    envp->__fpscr = temp;
>  
>    return 0;
> diff --git a/sysdeps/sh/sh4/fpu/ftestexcept.c b/sysdeps/sh/sh4/fpu/ftestexcept.c
> index 9e0bfc5..c2e1772 100644
> --- a/sysdeps/sh/sh4/fpu/ftestexcept.c
> +++ b/sysdeps/sh/sh4/fpu/ftestexcept.c
> @@ -26,6 +26,9 @@ fetestexcept (int excepts)
>  
>    /* Get current exceptions.  */
>    _FPU_GETCW (temp);
> +  /* When read fpscr, this was initialized.
> +     We need to rewrite value of temp. */
> +  _FPU_SETCW (temp);
>  
>    return temp & excepts & FE_ALL_EXCEPT;
>  }

Why is this needed?  It seems that I can't find it neither in the SH-4A
Software Manual nor in the SH7785 Hardware Manual.


Grüße,
 Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20120522/be689da8/attachment.sig>


More information about the Libc-alpha mailing list