re PR testsuite/51057 (FAIL: gfortran.dg/quad_2.f90 -O0 execution test on powerpc*-*-*)

2012-01-12  Dominique d'Humieres  <dominiq@lps.ens.fr>
            Tobias Burnus  <burnus@net-b.de>

        PR fortran/51057
        PR fortran/51616
        * lib/target-supports.exp
        (check_effective_target_fortran_largest_fp_has_sqrt): New.
        * gfortran.dg/quad_2.f90: Use it, add pattern for IBM's
        real(16).


Co-Authored-By: Tobias Burnus <burnus@net-b.de>

From-SVN: r183121
This commit is contained in:
Dominique d'Humieres 2012-01-12 07:53:59 +01:00 committed by Tobias Burnus
parent efcc9293a6
commit 725a74a517
3 changed files with 48 additions and 2 deletions

View File

@ -1,3 +1,12 @@
2012-01-12 Dominique d'Humieres <dominiq@lps.ens.fr>
Tobias Burnus <burnus@net-b.de>
PR fortran/51057
PR fortran/51616
* lib/target-supports.exp
(check_effective_target_fortran_largest_fp_has_sqrt): New.
* gfortran.dg/quad_2.f90: Use it, add pattern for IBM's real(16).
2012-01-11 Jason Merrill <jason@redhat.com>
PR c++/51565

View File

@ -1,4 +1,5 @@
! { dg-do run }
! { dg-require-effective-target fortran_largest_fp_has_sqrt }
!
! This test checks whether the largest possible
! floating-point number works.
@ -40,22 +41,36 @@ program test_qp
if (str2 /= "1.0000000000000000") call abort()
if (str3 /= " 1.4142135623730951") call abort()
if (str4 /= "1.4142135623730951") call abort()
case (10)
if (str1 /= " 1.00000000000000000000") call abort()
if (str2 /= "1.00000000000000000000") call abort()
if (str3 /= " 1.41421356237309504876") call abort()
if (str4 /= "1.41421356237309504876") call abort()
case (16)
if (str1 /= " 1.00000000000000000000000000000000000") call abort()
if (str2 /= "1.00000000000000000000000000000000000") call abort()
if (str3 /= " 1.41421356237309504880168872420969798") call abort()
if (str4 /= "1.41421356237309504880168872420969798") call abort()
if (digits(1.0_qp) == 113) then
! IEEE 754 binary 128 format
! e.g. libquadmath/__float128 on i686/x86_64/ia64
if (str3 /= " 1.41421356237309504880168872420969798") call abort()
if (str4 /= "1.41421356237309504880168872420969798") call abort()
else if (digits(1.0_qp) == 106) then
! IBM binary 128 format
if (str3(1:37) /= " 1.41421356237309504880168872420969") call abort()
if (str4(1:34) /= "1.41421356237309504880168872420969") call abort()
end if
! Do a libm run-time test
block
real(qp), volatile :: fp2a
fp2a = 2.0_qp
fp2a = sqrt (fp2a)
if (abs (fp2a - fp2) > sqrt(2.0_qp)-nearest(sqrt(2.0_qp),-1.0_qp)) call abort()
end block
case default
call abort()
end select

View File

@ -984,6 +984,28 @@ proc check_effective_target_fortran_real_16 { } {
}]
}
# Return 1 if the target supports SQRT for the largest floating-point
# type. (Some targets lack the libm support for this FP type.)
# On most targets, this check effectively checks either whether sqrtl is
# available or on __float128 systems whether libquadmath is installed,
# which provides sqrtq.
#
# When the target name changes, replace the cached result.
proc check_effective_target_fortran_largest_fp_has_sqrt { } {
return [check_no_compiler_messages fortran_largest_fp_has_sqrt executable {
! Fortran
use iso_fortran_env, only: real_kinds
integer,parameter:: maxFP = real_kinds(ubound(real_kinds,dim=1))
real(kind=maxFP), volatile :: x
x = 2.0_maxFP
x = sqrt (x)
end
}]
}
# Return 1 if the target supports Fortran integer kinds larger than
# integer(8), 0 otherwise.
#