or1k: Do not clear existing FPU exceptions before updating

Message ID 20230318080405.2799610-1-shorne@gmail.com
State Accepted
Headers
Series or1k: Do not clear existing FPU exceptions before updating |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Stafford Horne March 18, 2023, 8:04 a.m. UTC
  We should always carry the exceptions forward.  This bug was found when
working on testing glibc math tests, many tests were failing with
Overflow and Underflow flags not set.  This was traced to here.

libgcc/ChangeLog:

	* config/or1k/sfp-machine.h (FP_HANDLE_EXCEPTIONS): Remove
	statement clearing existing exceptions.
---
 libgcc/config/or1k/sfp-machine.h | 1 -
 1 file changed, 1 deletion(-)
  

Comments

Stafford Horne March 19, 2023, 6:48 a.m. UTC | #1
Hello,

I pushed this upstream.

On Sat, Mar 18, 2023 at 05:04:05PM +0900, Stafford Horne wrote:
> We should always carry the exceptions forward.  This bug was found when
> working on testing glibc math tests, many tests were failing with
> Overflow and Underflow flags not set.  This was traced to here.
> 
> libgcc/ChangeLog:
> 
> 	* config/or1k/sfp-machine.h (FP_HANDLE_EXCEPTIONS): Remove
> 	statement clearing existing exceptions.
> ---
>  libgcc/config/or1k/sfp-machine.h | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/libgcc/config/or1k/sfp-machine.h b/libgcc/config/or1k/sfp-machine.h
> index 162c6bc5326..c804270fb3c 100644
> --- a/libgcc/config/or1k/sfp-machine.h
> +++ b/libgcc/config/or1k/sfp-machine.h
> @@ -73,7 +73,6 @@ do {								\
>  do {								\
>    if (__builtin_expect (_fex, 0))				\
>      {								\
> -      _fpcsr &= ~FP_EX_ALL;					\
>        _fpcsr |= _fex;						\
>        __asm__ volatile ("l.mtspr r0,%0,20" : : "r" (_fpcsr));	\
>      }								\
> -- 
> 2.39.1
>
  

Patch

diff --git a/libgcc/config/or1k/sfp-machine.h b/libgcc/config/or1k/sfp-machine.h
index 162c6bc5326..c804270fb3c 100644
--- a/libgcc/config/or1k/sfp-machine.h
+++ b/libgcc/config/or1k/sfp-machine.h
@@ -73,7 +73,6 @@  do {								\
 do {								\
   if (__builtin_expect (_fex, 0))				\
     {								\
-      _fpcsr &= ~FP_EX_ALL;					\
       _fpcsr |= _fex;						\
       __asm__ volatile ("l.mtspr r0,%0,20" : : "r" (_fpcsr));	\
     }								\