On Mon, Aug 3, 2015 at 11:14 PM, FX <fxcoud...@gmail.com> wrote:
> The attached patch extends the IEEE modules to all floating-point kinds. Last 
> time, when I added IEEE support, I restricted it to the float and double 
> types (real kinds 4 and 8), to be extra safe. After discussion with Uros 
> Bizjak and some reading, I’ve come to the conclusion that on most hardware 
> where we support IEEE at all, we do support enough IEEE features on extended 
> and quad prec (long double and __float128, on x86_64 hardware) to satisfy the 
> Fortran standard.
>
> So, this enables full IEEE support for all real kinds. Nothing changes to the 
> underlying architecture, it’s almost exclusively mechanical changes (adding 
> the necessary variants to the interfaces, etc.).
>
> Bootstrapped and regtested on x86_64-apple-darwin14 (with associated 
> libquadmath patch: https://gcc.gnu.org/ml/gcc-patches/2015-08/msg00124.html).
> OK to commit to trunk?

> Index: libgfortran/config/fpu-387.h
> ===================================================================
> --- libgfortran/config/fpu-387.h (revision 226429)
> +++ libgfortran/config/fpu-387.h (working copy)
> @@ -461,12 +461,12 @@ set_fpu_state (void *state)
>
>
>  int
> -support_fpu_underflow_control (int kind)
> +support_fpu_underflow_control (int kind __attribute__((unused)))
>  {
>    if (!has_sse())
>      return 0;
>
> -  return (kind == 4 || kind == 8) ? 1 : 0;
> +  return 1;
>  }

x86 doesn't support underflow control for long double (x87) and
__float128 types, so the above change is wrong.

> Index: libgfortran/config/fpu-glibc.h
> ===================================================================
> --- libgfortran/config/fpu-glibc.h (revision 226429)
> +++ libgfortran/config/fpu-glibc.h (working copy)
> @@ -439,7 +439,7 @@ int
>  support_fpu_underflow_control (int kind __attribute__((unused)))
>  {
>  #if defined(__alpha__) && defined(FE_MAP_UMZ)
> -  return (kind == 4 || kind == 8) ? 1 : 0;
> +  return 1;
>  #else
>    return 0;
>  #endif

I'm not sure for alpha, if it supports underflow control for extended
types. Let's keep this as is for now, it is trivial to change later.

Uros.

Reply via email to