From patchwork Tue Nov 9 03:28:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry DeLisle X-Patchwork-Id: 70490 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 81FA0B710F for ; Tue, 9 Nov 2010 14:29:31 +1100 (EST) Received: (qmail 22613 invoked by alias); 9 Nov 2010 03:29:29 -0000 Received: (qmail 22596 invoked by uid 22791); 9 Nov 2010 03:29:27 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, TW_IB X-Spam-Check-By: sourceware.org Received: from out01.roch.ny.frontiernet.net (HELO out01.roch.ny.frontiernet.net) (66.133.183.226) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 09 Nov 2010 03:29:21 +0000 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAI9O2ExHc96u/2dsb2JhbACiHL1jhUgEhFiRDg Received: from relay03.roch.ny.frontiernet.net ([66.133.182.166]) by out01.roch.ny.frontiernet.net with ESMTP; 09 Nov 2010 03:29:19 +0000 X-Previous-IP: 71.115.222.174 Received: from quava.localdomain (pool-71-115-222-174.spknwa.dsl-w.verizon.net [71.115.222.174]) by relay03.roch.ny.frontiernet.net (Postfix) with ESMTPA id AE8FC10203; Tue, 9 Nov 2010 03:29:17 +0000 (UTC) Message-ID: <4CD8BFEF.1060207@frontier.com> Date: Mon, 08 Nov 2010 19:28:47 -0800 From: Jerry DeLisle User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101027 Fedora/3.1.6-1.fc13 Thunderbird/3.1.6 MIME-Version: 1.0 To: Jack Howarth CC: Tobias Burnus , gfortran , gcc patches Subject: Re: RFC patch: Add libquadmath - and use it in gfortran (round two) References: <4CD85E91.9000506@net-b.de> <20101108233315.GA20276@bromo.med.uc.edu> <20101109001921.GA60415@troutmask.apl.washington.edu> <20101109005035.GA20709@bromo.med.uc.edu> <20101109013239.GA60769@troutmask.apl.washington.edu> <20101109014102.GA20973@bromo.med.uc.edu> <4CD8AFF9.5010300@frontier.com> <20101109023600.GA21216@bromo.med.uc.edu> In-Reply-To: <20101109023600.GA21216@bromo.med.uc.edu> 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 11/08/2010 06:36 PM, Jack Howarth wrote: > On Mon, Nov 08, 2010 at 06:20:41PM -0800, Jerry DeLisle wrote: >> I am currently bootstrapping the patches. I am curious what these tmp1 >> and tmp2 are about? Also see them on the real128 versions as well. >> >> #if defined(GFC_REAL_16_IS_FLOAT128) >> void >> transfer_complex128 (st_parameter_dt *dtp, void *p, int kind) >> { >> static void *tmp1 = quadmath_strtopQ; >> static void *tmp2 = quadmath_dtoaq; >> >> transfer_complex (dtp, p, kind); >> } >> >> >> void >> transfer_complex_write128 (st_parameter_dt *dtp, void *p, int kind) >> { >> static void *tmp1 = quadmath_strtopQ; >> static void *tmp2 = quadmath_dtoaq; >> >> transfer_complex (dtp, p, kind); >> } >> #endif >> >> >> Jerry > > Jerry, > With the corrections to libgfortran/transfer.c that I mentioned in... > > http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00830.html > > the example... > > program test_qp > implicit none > integer, parameter :: QP = 16 > real(QP), parameter :: Z1 = 1,HALF_PI = asin(Z1),PI = HALF_PI+HALF_PI > real(QP) :: x = 0.124_QP > print *, x > print *, PI > print *, 16*atan(0.2_QP)-4*atan(Z1/239) > print *, sin(PI) > print *, cos(HALF_PI) > print *, asinh(PI) > print *, erfc(Z1) > print *, epsilon(x) > print *, precision(x) > print *, digits(x) > end program test_qp > > compiles without error and the resulting binary on x86_64-apple-darwin10 > produces the output... > > 0.12399999999999999999999999999999999 > 3.1415926535897932384626433832795028 > 3.1415926535897932384626433832795032 > 8.67181013012378102479704402604335225E-0035 > 4.33590506506189051239852201302167613E-0035 > 1.8622957433108482198883613251826206 > 0.15729920705028513065877936491739074 > 1.92592994438723585305597794258492732E-0034 > 33 > 113 > > Jack > I get this as well: $ gfc test-qp.f90 $ ./a.out 0.12399999999999999999999999999999999 3.1415926535897932384626433832795028 3.1415926535897932384626433832795032 8.67181013012378102479704402604335225E-0035 4.33590506506189051239852201302167613E-0035 1.8622957433108482198883613251826206 0.15729920705028513065877936491739074 1.92592994438723585305597794258492732E-0034 33 113 I ended up with the attached diff for transfer.c. (diff against trunk) Tobias, revert your local transfer.c and apply this one. I also tested with some other programs I had done previously and all looks OK. Regression testing is on going. Regards, Jerry Index: transfer.c =================================================================== --- transfer.c (revision 166460) +++ transfer.c (working copy) @@ -56,6 +56,8 @@ see the files COPYING3 and COPYING.RUNTIME respect transfer_character_wide transfer_real transfer_complex + transfer_real128 + transfer_complex128 These subroutines do not return status. @@ -76,6 +78,14 @@ export_proto(transfer_real); extern void transfer_real_write (st_parameter_dt *, void *, int); export_proto(transfer_real_write); +#if defined(GFC_REAL_16_IS_FLOAT128) +extern void transfer_real128 (st_parameter_dt *, void *, int); +export_proto(transfer_real128); + +extern void transfer_real_write128 (st_parameter_dt *, void *, int); +export_proto(transfer_real_write128); +#endif + extern void transfer_logical (st_parameter_dt *, void *, int); export_proto(transfer_logical); @@ -98,6 +108,14 @@ export_proto(transfer_character_wide_write); extern void transfer_complex (st_parameter_dt *, void *, int); export_proto(transfer_complex); +#if defined(GFC_REAL_16_IS_FLOAT128) +extern void transfer_complex128 (st_parameter_dt *, void *, int); +export_proto(transfer_complex128); + +extern void transfer_complex_write128 (st_parameter_dt *, void *, int); +export_proto(transfer_complex_write128); +#endif + extern void transfer_complex_write (st_parameter_dt *, void *, int); export_proto(transfer_complex_write); @@ -1892,7 +1910,25 @@ transfer_real_write (st_parameter_dt *dtp, void *p transfer_real (dtp, p, kind); } +/* Make sure that libquadmath is pulled in. */ + +#if defined(GFC_REAL_16_IS_FLOAT128) void +transfer_real128 (st_parameter_dt *dtp, void *p, int kind) +{ + transfer_real (dtp, p, kind); +} + + +void +transfer_real_write128 (st_parameter_dt *dtp, void *p, int kind) +{ + transfer_real (dtp, p, kind); +} +#endif + + +void transfer_logical (st_parameter_dt *dtp, void *p, int kind) { if ((dtp->common.flags & IOPARM_LIBRETURN_MASK) != IOPARM_LIBRETURN_OK) @@ -1964,13 +2000,33 @@ transfer_complex (st_parameter_dt *dtp, void *p, i dtp->u.p.transfer (dtp, BT_COMPLEX, p, kind, size, 1); } + void transfer_complex_write (st_parameter_dt *dtp, void *p, int kind) { transfer_complex (dtp, p, kind); } + +/* Make sure that libquadmath is pulled in. */ + +#if defined(GFC_REAL_16_IS_FLOAT128) void +transfer_complex128 (st_parameter_dt *dtp, void *p, int kind) +{ + transfer_complex (dtp, p, kind); +} + + +void +transfer_complex_write128 (st_parameter_dt *dtp, void *p, int kind) +{ + transfer_complex (dtp, p, kind); +} +#endif + + +void transfer_array (st_parameter_dt *dtp, gfc_array_char *desc, int kind, gfc_charlen_type charlen) {