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