Re: [fortran,patch] Extend IEEE support to all real kinds

2015-08-09 Thread FX
 2015-08-06  Uros Bizjak  ubiz...@gmail.com
 
PR fortran/64022
* gfortran.dg/ieee/large_4.f90: New test.
 
 Tested on x86_64-linux-gnu {,-m32}  and alphaev68-linux-gnu.
 OK for mainline?

OK. Thanks for the patch!

FX


Re: [fortran,patch] Extend IEEE support to all real kinds

2015-08-07 Thread FX
 I think it's a bad idea committing an (approved) patch without the
 prerequisite, introducing testsuite failures for everyone and sending us
 all hunting what's wrong ;-(

I realize I probably should have XFAIL’ed the testcase, indeed. But I was 
hoping for a quick review of the simple libquadmath patch :(

Sorry,
FX

Re: [fortran,patch] Extend IEEE support to all real kinds

2015-08-07 Thread Rainer Orth
FX fxcoud...@gmail.com writes:

 FAIL: gfortran.dg/ieee/large_1.f90   -O0  (test for excess errors)
 Excess errors:
 large_1.f90:(.text+0x1792): undefined reference to `logbq’

 Fixed by the patch there:
 https://gcc.gnu.org/ml/gcc-patches/2015-08/msg00124.html
 Waiting for review.

I think it's a bad idea committing an (approved) patch without the
prerequisite, introducing testsuite failures for everyone and sending us
all hunting what's wrong ;-(

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [fortran,patch] Extend IEEE support to all real kinds

2015-08-06 Thread FX
 Can you please also introduce tests for ieee exceptions for long
 double and __float128 types (as is done for real and double in
 gfortran.dg/ieee/ieee_1.F90) as well as test for supported rounding
 modes as done for real and double in gfortran.dg/ieee/rounding_1.f90 ?
 
 On x86_64, these new tests will exercise exceptions and rounding modes
 for __float128 soft-fp library, in addition to x87 long double tests.

I’ve now introduced the tests for rounding (large_2.f90) and exceptions 
(large_3.F90):

Adding gfortran.dg/ieee/large_2.f90
Adding gfortran.dg/ieee/large_3.F90
Transmitting file data ...
Committed revision 226670.



Re: [fortran,patch] Extend IEEE support to all real kinds

2015-08-06 Thread Uros Bizjak
On Thu, Aug 6, 2015 at 11:26 AM, FX fxcoud...@gmail.com wrote:
 Can you please also introduce tests for ieee exceptions for long
 double and __float128 types (as is done for real and double in
 gfortran.dg/ieee/ieee_1.F90) as well as test for supported rounding
 modes as done for real and double in gfortran.dg/ieee/rounding_1.f90 ?

 On x86_64, these new tests will exercise exceptions and rounding modes
 for __float128 soft-fp library, in addition to x87 long double tests.

 I’ve now introduced the tests for rounding (large_2.f90) and exceptions 
 (large_3.F90):

Attached to this message, please find the testcase for underflow
control for large types. I was using this test to check for support of
large types on x86_64 and alpha. I can confirm that neither target
supports underflow control for large types, but nevertheless I think
the test could be used as a negative test for
ieee_support_underflow_control.

2015-08-06  Uros Bizjak  ubiz...@gmail.com

PR fortran/64022
* gfortran.dg/ieee/large_4.f90: New test.

Tested on x86_64-linux-gnu {,-m32}  and alphaev68-linux-gnu.

OK for mainline?

Uros.
Index: gfortran.dg/ieee/large_4.f90
===
--- gfortran.dg/ieee/large_4.f90(revision 0)
+++ gfortran.dg/ieee/large_4.f90(working copy)
@@ -0,0 +1,54 @@
+! { dg-do run }
+
+program test_underflow_control
+  use ieee_arithmetic
+  use iso_fortran_env
+
+  ! kx and ky will be large real kinds, if supported, and single/double
+  ! otherwise
+  integer, parameter :: kx = 
+max(ieee_selected_real_kind(precision(0.d0) + 1), kind(0.))
+  integer, parameter :: ky = 
+max(ieee_selected_real_kind(precision(0._kx) + 1), kind(0.d0))
+
+  logical l
+  real(kind=kx), volatile :: x
+  real(kind=ky), volatile :: y
+
+  if (ieee_support_underflow_control(x)) then
+
+x = tiny(x)
+call ieee_set_underflow_mode(.true.)
+x = x / 2000._kx
+if (x == 0) call abort
+call ieee_get_underflow_mode(l)
+if (.not. l) call abort
+
+x = tiny(x)
+call ieee_set_underflow_mode(.false.)
+x = x / 2000._kx
+if (x  0) call abort
+call ieee_get_underflow_mode(l)
+if (l) call abort
+
+  end if
+
+  if (ieee_support_underflow_control(y)) then
+
+y = tiny(y)
+call ieee_set_underflow_mode(.true.)
+y = y / 2000._ky
+if (y == 0) call abort
+call ieee_get_underflow_mode(l)
+if (.not. l) call abort
+
+y = tiny(y)
+call ieee_set_underflow_mode(.false.)
+y = y / 2000._ky
+if (y  0) call abort
+call ieee_get_underflow_mode(l)
+if (l) call abort
+
+  end if
+
+end program


Re: [fortran,patch] Extend IEEE support to all real kinds

2015-08-05 Thread Andreas Schwab
FAIL: gfortran.dg/ieee/large_1.f90   -O0  (test for excess errors)
Excess errors:
large_1.f90:(.text+0x1792): undefined reference to `logbq'

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
And now for something completely different.


Re: [fortran,patch] Extend IEEE support to all real kinds

2015-08-05 Thread FX
 FAIL: gfortran.dg/ieee/large_1.f90   -O0  (test for excess errors)
 Excess errors:
 large_1.f90:(.text+0x1792): undefined reference to `logbq’

Fixed by the patch there: 
https://gcc.gnu.org/ml/gcc-patches/2015-08/msg00124.html
Waiting for review.

FX



Re: [fortran,patch] Extend IEEE support to all real kinds

2015-08-03 Thread Uros Bizjak
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.


Re: [fortran,patch] Extend IEEE support to all real kinds

2015-08-03 Thread Uros Bizjak
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?

Can you please also introduce tests for ieee exceptions for long
double and __float128 types (as is done for real and double in
gfortran.dg/ieee/ieee_1.F90) as well as test for supported rounding
modes as done for real and double in gfortran.dg/ieee/rounding_1.f90 ?

On x86_64, these new tests will exercise exceptions and rounding modes
for __float128 soft-fp library, in addition to x87 long double tests.

Uros.


Re: [fortran,patch] Extend IEEE support to all real kinds

2015-08-03 Thread Steve Kargl
On Mon, Aug 03, 2015 at 11:14:41PM +0200, FX wrote:
 
 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?
 

This is OK to commit.  It's unclear whether I've
sufficient authority to OK the libquadmath path.

 
 PS: Once this is in, I intend to focus on the next item: allowing
 all standard-mandated IEEE functions in constant expressions.  Then,
 I believe our IEEE support will be entirely bug-free (in the sense
 that there will be no known bugs in it!).
 

See PR libquadmath/65757.  I'm not sure if it effects 
the IEEE support other than libquadmath has issues.

-- 
Steve