From patchwork Sun Nov 14 13:59:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jack Howarth X-Patchwork-Id: 71114 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 80711B7114 for ; Mon, 15 Nov 2010 01:00:13 +1100 (EST) Received: (qmail 23087 invoked by alias); 14 Nov 2010 14:00:07 -0000 Received: (qmail 23052 invoked by uid 22791); 14 Nov 2010 14:00:05 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, TW_BG, TW_IB, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from bromo.med.uc.edu (HELO bromo.med.uc.edu) (129.137.3.146) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Sun, 14 Nov 2010 13:59:09 +0000 Received: from bromo.med.uc.edu (localhost.localdomain [127.0.0.1]) by bromo.med.uc.edu (Postfix) with ESMTP id C1A2BB0076; Sun, 14 Nov 2010 08:59:07 -0500 (EST) Received: (from howarth@localhost) by bromo.med.uc.edu (8.14.3/8.14.3/Submit) id oAEDx7pA032759; Sun, 14 Nov 2010 08:59:07 -0500 Date: Sun, 14 Nov 2010 08:59:07 -0500 From: Jack Howarth To: Tobias Burnus Cc: gcc patches , gfortran Subject: Re: Add libquadmath - and use it in gfortran (round FIVE) Message-ID: <20101114135907.GA32748@bromo.med.uc.edu> References: <4CDF0358.8030602@net-b.de> <20101113231203.GA5766@bromo.med.uc.edu> <4CDFA26C.2050505@net-b.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4CDFA26C.2050505@net-b.de> User-Agent: Mutt/1.5.18 (2008-05-17) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On Sun, Nov 14, 2010 at 09:48:44AM +0100, Tobias Burnus wrote: > Jack Howarth wrote: >> On Sat, Nov 13, 2010 at 10:30:00PM +0100, Tobias Burnus wrote: >>> It consists of: >>> - The attached patch [http://gcc.gnu.org/ml/gcc-patches/2010-11/msg01442/quad.diff.bz2] >>> - The attached changelog [http://gcc.gnu.org/ml/gcc-patches/2010-11/txt00112.txt] >>> - The library (unchanged): >>> http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00790/libquadmath.tar.bz2 >>> - The test case at http://gcc.gnu.org/ml/gcc-patches/2010-11/txt00070.tx >>> >>> For convenience [...] the generated files as additional attachment. [http://gcc.gnu.org/ml/gcc-patches/2010-11/msg01442/quad-gen.diff.bz2] >>> >> You appear to have omitted the change that adds... >> echo '#include "kinds-override.h"' >> ...to mk-kinds-h.sh again. > > I had checked the diff twice - and missed it. see attachment. > > Tobias Tobias, Actually the part of the diff that is missing is (from the previous)... > /* Header used to override things detected by the mk-kinds-h.sh script. > Copyright (C) 2010 Free Software Foundation, Inc. > > This file is part of the GNU Fortran runtime library (libgfortran). > > Libgfortran is free software; you can redistribute it and/or modify > it under the terms of the GNU General Public License as published by > the Free Software Foundation; either version 3, or (at your option) > any later version. > > Libgfortran is distributed in the hope that it will be useful, > but WITHOUT ANY WARRANTY; without even the implied warranty of > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > GNU General Public License for more details. > > Under Section 7 of GPL version 3, you are granted additional > permissions described in the GCC Runtime Library Exception, version > 3.1, as published by the Free Software Foundation. > > You should have received a copy of the GNU General Public License and > a copy of the GCC Runtime Library Exception along with this program; > see the files COPYING3 and COPYING.RUNTIME respectively. If not, see > . */ > > > /* What are the C types corresponding to the real(kind=10) and > real(kind=16) types? We currently rely on the following assumptions: > -- if real(kind=10) exists, i.e. if HAVE_GFC_REAL_10 is defined, > then it is necessarily the "long double" type > -- if real(kind=16) exists, then: > * if HAVE_GFC_REAL_10, real(kind=16) is "__float128" > * otherwise, real(kind=16) is "long double" > To allow to change this in the future, we create the > GFC_REAL_16_IS_FLOAT128 macro that is used throughout libgfortran. */ > > #if defined(HAVE_GFC_REAL_16) > # if defined(HAVE_GFC_REAL_10) > # define GFC_REAL_16_IS_FLOAT128 > # if !defined(HAVE_FLOAT128) > # error "Where has __float128 gone?" > # endif > # else > # define GFC_REAL_16_IS_LONG_DOUBLE > # endif > #endif > diff --git a/libgfortran/mk-kinds-h.sh b/libgfortran/mk-kinds-h.sh index 0b8dbc5..98a95ab 100755 --- a/libgfortran/mk-kinds-h.sh +++ b/libgfortran/mk-kinds-h.sh @@ -44,7 +44,14 @@ echo "#define GFC_UINTEGER_LARGEST GFC_UINTEGER_${largest}" echo "#define GFC_DEFAULT_CHAR ${smallest}" echo "" -REAL_10_FOUND= + +# Get the kind value for long double, so we may disambiguate it +# from __float128. +echo "use iso_c_binding; print *, c_long_double ; end" > tmq$$.f90 +long_double_kind=`$compile -S -fdump-parse-tree tmq$$.f90 | grep TRANSFER \ + | sed 's/ *TRANSFER *//'` +rm -f tmq$$.* + for k in $possible_real_kinds; do echo " real (kind=$k) :: x" > tmp$$.f90 @@ -52,17 +59,18 @@ for k in $possible_real_kinds; do echo " end" >> tmp$$.f90 if $compile -S tmp$$.f90 > /dev/null 2>&1; then case $k in - 4) ctype="float" ; suffix="f" ;; - 8) ctype="double" ; suffix="" ;; - 10) ctype="long double" ; suffix="l" ; REAL_10_FOUND=1 ;; - 16) ctype="long double" - suffix="l" - # Disable REAL(16) if it is just __float128 - # until the library is fixed - if [ -n "$REAL_10_FOUND" ]; then - continue - fi - ;; + 4) ctype="float" ; cplxtype="complex float" ; suffix="f" ;; + 8) ctype="double" ; cplxtype="complex double" ; suffix="" ;; + 10) ctype="long double" ; cplxtype="complex long double" ; suffix="l" ;; + 16) if [ $long_double_kind -eq 10 ]; then + ctype="__float128" + cplxtype="_Complex float __attribute__((mode(TC)))" + suffix="q" + else + ctype="long double" + cplxtype="complex long double" + suffix="l" + fi ;; *) echo "$0: Unknown type" >&2 ; exit 1 ;; esac @@ -86,7 +94,7 @@ for k in $possible_real_kinds; do # Output the information we've gathered echo "typedef ${ctype} GFC_REAL_${k};" - echo "typedef complex ${ctype} GFC_COMPLEX_${k};" + echo "typedef ${cplxtype} GFC_COMPLEX_${k};" echo "#define HAVE_GFC_REAL_${k}" echo "#define HAVE_GFC_COMPLEX_${k}" echo "#define GFC_REAL_${k}_HUGE ${huge}${suffix}" @@ -103,4 +111,9 @@ for k in $possible_real_kinds; do rm -f tmp$$.* done + +# After this, we include a header that can override some of the +# autodetected settings. +echo '#include "kinds-override.h"' + exit 0