[1/4] alpha: add the denormal trap enable bit to FE_NOMASK_ENV

Message ID 20260803235509.3532030-2-mattst88@gmail.com (mailing list archive)
State Committed
Commit 8e41f6008df3b5d56df199e8b4d19891666857a4
Headers
Series Fix underflow signalling for narrowing operations on Alpha |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_glibc_check--master-arm success Test passed

Commit Message

Matt Turner Aug. 3, 2026, 11:55 p.m. UTC
  FE_NOMASK_ENV is the floating-point environment in which no exception is
masked, so it must enable every exception that FE_ALL_EXCEPT covers.  On
Alpha that includes the GNU extension FE_DENORMAL, whose SWCR trap enable
bit is IEEE_TRAP_ENABLE_DNO (bit 6).

The constant only set bits 1 through 5 (INV, DZE, OVF, UNF and INE), so
after fesetenv (FE_NOMASK_ENV) a subsequent fegetexcept () returned
0x3e0000 rather than FE_ALL_EXCEPT (0x7e0000), and denormal exceptions
stayed masked.  Set bit 6 as well.

Fixes math/test-fenv-return on alpha.
---
 sysdeps/alpha/fpu/bits/fenv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Adhemerval Zanella Netto Aug. 4, 2026, 12:49 p.m. UTC | #1
On 03/08/26 20:55, Matt Turner wrote:
> FE_NOMASK_ENV is the floating-point environment in which no exception is
> masked, so it must enable every exception that FE_ALL_EXCEPT covers.  On
> Alpha that includes the GNU extension FE_DENORMAL, whose SWCR trap enable
> bit is IEEE_TRAP_ENABLE_DNO (bit 6).
> 
> The constant only set bits 1 through 5 (INV, DZE, OVF, UNF and INE), so
> after fesetenv (FE_NOMASK_ENV) a subsequent fegetexcept () returned
> 0x3e0000 rather than FE_ALL_EXCEPT (0x7e0000), and denormal exceptions
> stayed masked.  Set bit 6 as well.
> 
> Fixes math/test-fenv-return on alpha.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/alpha/fpu/bits/fenv.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git ./sysdeps/alpha/fpu/bits/fenv.h ./sysdeps/alpha/fpu/bits/fenv.h
> index b1135f1f0a..530f298914 100644
> --- ./sysdeps/alpha/fpu/bits/fenv.h
> +++ ./sysdeps/alpha/fpu/bits/fenv.h
> @@ -121,7 +121,7 @@ typedef unsigned long int fenv_t;
>  
>  #ifdef __USE_GNU
>  /* Floating-point environment where none of the exceptions are masked.  */
> -# define FE_NOMASK_ENV	((const fenv_t *) 0x880000000000003eUL)
> +# define FE_NOMASK_ENV	((const fenv_t *) 0x880000000000007eUL)
>  
>  /* Floating-point environment with (processor-dependent) non-IEEE floating
>     point.  In this case, mapping denormals to zero.  */
  

Patch

diff --git ./sysdeps/alpha/fpu/bits/fenv.h ./sysdeps/alpha/fpu/bits/fenv.h
index b1135f1f0a..530f298914 100644
--- ./sysdeps/alpha/fpu/bits/fenv.h
+++ ./sysdeps/alpha/fpu/bits/fenv.h
@@ -121,7 +121,7 @@  typedef unsigned long int fenv_t;
 
 #ifdef __USE_GNU
 /* Floating-point environment where none of the exceptions are masked.  */
-# define FE_NOMASK_ENV	((const fenv_t *) 0x880000000000003eUL)
+# define FE_NOMASK_ENV	((const fenv_t *) 0x880000000000007eUL)
 
 /* Floating-point environment with (processor-dependent) non-IEEE floating
    point.  In this case, mapping denormals to zero.  */