From patchwork Mon Jul 7 08:56:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 367449 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 7C8CB1400B8 for ; Mon, 7 Jul 2014 18:56:26 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type; q=dns; s=default; b=IkIQhhzf6j9vu4rH LyJqwycWtapqyP7Iot01dCZkZpW9rQKY+e+mnxfkMBv8xFPsAj4+UDtYEHhf6QgZ yX3aDxqwX90zHeTg5aYCfhclDhHl4wfnOyQogzbpjBJm6m4NlaXYO6DJ8jh5zN8N vf7QL6SIv071q5DxCti7//OFV3M= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type; s=default; bh=lDFSwxlsvxxgyPCvz0jAaf 2NC9Q=; b=DhQJvDRKbmsovHFEIv9Y7F26/ZvzOERzwODMym2N15NeNYgHWeJlaI xWHQqfDkF2KJRzaG0Au3+JVr01oM6/bgd4F1Q363+ZG5Dgvmrfnnp4ieiTbGuAOb l0oK+oZhM9GrD/IW4ik+oN8UJ8kjAr16HUIUMKdiTPw2q277sVEWU= Received: (qmail 30341 invoked by alias); 7 Jul 2014 08:56:19 -0000 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 Received: (qmail 30307 invoked by uid 89); 7 Jul 2014 08:56:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: smtp-relay.CeBiTec.Uni-Bielefeld.DE Received: from snape.CeBiTec.Uni-Bielefeld.DE (HELO smtp-relay.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 07 Jul 2014 08:56:15 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 54F95E4; Mon, 7 Jul 2014 10:56:13 +0200 (CEST) Received: from smtp-relay.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id MzmFhXXauNY4; Mon, 7 Jul 2014 10:56:10 +0200 (CEST) Received: from lokon.CeBiTec.Uni-Bielefeld.DE (lokon.CeBiTec.Uni-Bielefeld.DE [129.70.161.110]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id BBEBCE3; Mon, 7 Jul 2014 10:56:10 +0200 (CEST) Received: (from ro@localhost) by lokon.CeBiTec.Uni-Bielefeld.DE (8.14.7+Sun/8.14.7/Submit) id s678u9H7002252; Mon, 7 Jul 2014 10:56:09 +0200 (MEST) From: Rainer Orth To: FX Cc: Steve Kargl , Tobias Burnus , "gcc-patches\@gcc.gnu.org" , Fortran List Subject: Re: [fortran, patch] IEEE intrinsic modules (ping) References: <20140623192339.GA25679@troutmask.apl.washington.edu> <20140623202005.GA31501@troutmask.apl.washington.edu> <6CA4B0CC-09B5-439C-A766-B27664B2DB12@gmail.com> <20140624164936.GA38820@troutmask.apl.washington.edu> <20140624174601.GA39016@troutmask.apl.washington.edu> <53A9C4AF.6020700@net-b.de> <20140624191947.GA70297@troutmask.apl.washington.edu> <20140624202327.GA81301@troutmask.apl.washington.edu> <4006CA91-3464-4A9A-A228-66FA6C02673B@gmail.com> <20140624203658.GA81560@troutmask.apl.washington.edu> <98E798A9-5DD5-40ED-B487-E1A6B77B66A9@gmail.com> Date: Mon, 07 Jul 2014 10:56:09 +0200 In-Reply-To: <98E798A9-5DD5-40ED-B487-E1A6B77B66A9@gmail.com> (FX's message of "Mon, 7 Jul 2014 10:37:43 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes Hi FX, >> while the i386/amd64 values are the usual ones. Unfortunately, >> gcc/fortran/libgfortran.h hardcodes the more common values for >> GFC_FPE_*, and libgfortran/Makefile.am extracts them from there into >> fpu-target.inc. I'm unsure what's the best way to handle this. > > No, we don’t hardcode any values (unless I misunderstand what you are > saying). Look at libgfortran/config/fpu-sysv.h get_fpu_rounding_mode() and > set_fpu_rounding_mode(): we have two switches, to translate between the > GFC_FPE_* values and the FP_R* values. So this should work, really. you're right, of course. > The only thing I can see is that libgfortran/config/fpu-sysv.h assumes that > FP_RM and others are macros, checking them with "#ifdef FP_RM”. Is that the > reason? It is. > If so, we might just want to use them unconditionally… unless it creates a > mess on some other SysV target! FWIW, those FP_* values are also enum values in IRIX 6.5 , the only other SysV target I have around. Seems this file is common between all of them, so the risk should be manageable. The following patch does away with the #ifdef stuff and lets all gfortran.dg/ieee tests PASS on sparc-sun-solaris2.11. Ok for mainline? Rainer 2014-07-07 Rainer Orth * config/fpu-sysv.h (get_fpu_rounding_mode): Use FP_RN, FP_RP, FP_RM, FP_RZ unconditionally. (set_fpu_rounding_mode): Likewise. diff --git a/libgfortran/config/fpu-sysv.h b/libgfortran/config/fpu-sysv.h --- a/libgfortran/config/fpu-sysv.h +++ b/libgfortran/config/fpu-sysv.h @@ -333,25 +335,14 @@ get_fpu_rounding_mode (void) { switch (fpgetround ()) { -#ifdef FP_RN case FP_RN: return GFC_FPE_TONEAREST; -#endif - -#ifdef FP_RP case FP_RP: return GFC_FPE_UPWARD; -#endif - -#ifdef FP_RM case FP_RM: return GFC_FPE_DOWNWARD; -#endif - -#ifdef FP_RZ case FP_RZ: return GFC_FPE_TOWARDZERO; -#endif default: return GFC_FPE_INVALID; } @@ -365,29 +356,18 @@ set_fpu_rounding_mode (int mode) switch (mode) { -#ifdef FP_RN case GFC_FPE_TONEAREST: rnd_mode = FP_RN; break; -#endif - -#ifdef FP_RP case GFC_FPE_UPWARD: rnd_mode = FP_RP; break; -#endif - -#ifdef FP_RM case GFC_FPE_DOWNWARD: rnd_mode = FP_RM; break; -#endif - -#ifdef FP_RZ case GFC_FPE_TOWARDZERO: rnd_mode = FP_RZ; break; -#endif default: return; } @@ -401,33 +381,13 @@ support_fpu_rounding_mode (int mode) switch (mode) { case GFC_FPE_TONEAREST: -#ifdef FP_RN return 1; -#else - return 0; -#endif - case GFC_FPE_UPWARD: -#ifdef FP_RP return 1; -#else - return 0; -#endif - case GFC_FPE_DOWNWARD: -#ifdef FP_RM return 1; -#else - return 0; -#endif - case GFC_FPE_TOWARDZERO: -#ifdef FP_RZ return 1; -#else - return 0; -#endif - default: return 0; }