From patchwork Tue Nov 24 10:55:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Weigand X-Patchwork-Id: 1405476 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=uNsLwvZT; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CgLXT3wVpz9sRK for ; Tue, 24 Nov 2020 21:55:36 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A5732389801C; Tue, 24 Nov 2020 10:55:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A5732389801C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1606215334; bh=3BV/B5J+9ti1hepFTKe3jX/Vk8GxJJsklfQIGUKYNbo=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=uNsLwvZT0FrWq42cPS/sVvtOYu0u9rI2WDe1J8J1lBe9uh+r6Gh2t9c8NYAXdexh9 aCFLC9BAEvNWimeHK9Hz4sb1FOy+cxcWu5Yjc6RIzIYcvpP6V4rrsqvxJJvwAwC/KS jMucP6g7dSCZFR5U9O5gouOxclRRSamtnBVWjww0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 34CBE3898017 for ; Tue, 24 Nov 2020 10:55:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 34CBE3898017 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0AOAXtF5046244; Tue, 24 Nov 2020 05:55:30 -0500 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 350y8jtnkm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 Nov 2020 05:55:29 -0500 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 0AOAaWFb063848; Tue, 24 Nov 2020 05:55:29 -0500 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 350y8jtnjp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 Nov 2020 05:55:29 -0500 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0AOAqrxJ003309; Tue, 24 Nov 2020 10:55:26 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma03fra.de.ibm.com with ESMTP id 34yy8r0wx0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 Nov 2020 10:55:26 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0AOAtOWK20971984 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 Nov 2020 10:55:24 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 33DBE5205A; Tue, 24 Nov 2020 10:55:24 +0000 (GMT) Received: from oc3748833570.ibm.com (unknown [9.145.184.160]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 19AFF5204E; Tue, 24 Nov 2020 10:55:24 +0000 (GMT) Received: by oc3748833570.ibm.com (Postfix, from userid 1000) id 8A0D7D802A9; Tue, 24 Nov 2020 11:55:23 +0100 (CET) Date: Tue, 24 Nov 2020 11:55:23 +0100 To: Segher Boessenkool Subject: [wwwdocs] Re: [PATCH v2] Fix -ffast-math flags handling inconsistencies Message-ID: <20201124105523.GA14751@oc3748833570.ibm.com> References: <20200211184332.0968DD80313@oc3748833570.ibm.com> <408dfef3-b4ea-9605-5466-efd215f573cd@redhat.com> <20201121195732.GF2672@gate.crashing.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201121195732.GF2672@gate.crashing.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312, 18.0.737 definitions=2020-11-24_04:2020-11-24, 2020-11-23 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 lowpriorityscore=0 malwarescore=0 phishscore=0 spamscore=0 suspectscore=0 clxscore=1011 mlxlogscore=999 priorityscore=1501 adultscore=0 bulkscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011240061 X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Ulrich Weigand via Gcc-patches From: Ulrich Weigand Reply-To: Ulrich Weigand Cc: gcc-patches@gcc.gnu.org, joseph@codesourcery.com Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" On Sat, Nov 21, 2020 at 01:57:32PM -0600, Segher Boessenkool wrote: > On Fri, Nov 20, 2020 at 09:33:48PM -0700, Jeff Law wrote: > > On 2/11/20 11:43 AM, Ulrich Weigand wrote: > > > 1. If a component flag of -ffast-math (or -funsafe-math-optimizations) > > > is explicitly set (or reset) on the command line, this should override > > > any implicit change due to -f(no-)fast-math, no matter in which order > > > the flags come on the command line. This change affects all flags. > > > > > > 2. Any component flag modified from its default by -ffast-math should > > > be reset to the default by -fno-fast-math. This was previously > > > not done for the following flags: > > > -fcx-limited-range > > > -fexcess-precision= > > > > > > 3. Once -ffinite-math-only is true, the -f(no-)signaling-nans flag has > > > no meaning (if we have no NaNs at all, it does not matter whether > > > there is a difference between quiet and signaling NaNs). Therefore, > > > it does not make sense for -ffast-math to imply -fno-signaling-nans. > > > This is also a documentation change. > > > > > > 4. -ffast-math is documented to imply -fno-rounding-math, however the > > > latter setting is the default anyway; therefore it does not make > > > sense to try to modify it from its default setting. > > > > > > 5. The __FAST_MATH__ preprocessor macro should be defined if and only > > > if all the component flags of -ffast-math are set to the value that > > > is documented as the effect of -ffast-math. The following flags > > > were currently *not* so tested: > > > -fcx-limited-range > > > -fassociative-math > > > -freciprocal-math > > > -frounding-math > > > (Note that we should still *test* for -fno-rounding-math here even > > > though it is not set as per 4. -ffast-math -frounding-math should > > > not set the __FAST_MATH__ macro.) > > > This is also a documentation change. > > > It appears this was dropped on the floor.? It looks reasonable to me.? > > Please retest and commit.? Thanks! I've now retested on s390x-ibm-linux and committed to mainline. Thanks for the review! > It all makes sense, and is a nice improvement :-) But please mention it > in the release notes? No doubt people did use non-sensical flag > combinations, and they will be affected. Thanks! Here's a proposed patch to update the gcc-11 changes.hmtl. OK to commit? Bye, Ulrich diff --git a/htdocs/gcc-11/changes.html b/htdocs/gcc-11/changes.html index 46a6a37..c0f896a 100644 --- a/htdocs/gcc-11/changes.html +++ b/htdocs/gcc-11/changes.html @@ -58,6 +58,29 @@ a work-in-progress.

is deprecated and will be removed in a future release. It should be possible to use --enable-cheaders=c_global (the default) with no change in behaviour. + +
  • Some inconsistencies in handling combinations of -ffast-math, + -fno-fast-math, -funsafe-math-optimizations, + -fno-unsafe-math-optimizations, and their component flags + have been fixed. This might change the behavior of the compiler when + invoked with certain combinations of such command line options. + The behavior is now consistently: +
      +
    • If a component flag of -ffast-math or + -funsafe-math-optimizations is explicitly set or reset + on the command line, this will override any implicit change, no matter + in which order the flags come on the command line.
    • +
    • Any component flag (which is not explicity set or reset on the command + line) that was modified from its default by -ffast-math or + -funsafe-math-optimizations is always reset to its default + by a subsequent -fno-fast-math or + -fno-unsafe-math-optimizations.
    • +
    • -ffast-math no longer implicitly changes + -fsignaling-math. +
    • The __FAST_MATH__ preprocessor macro is set if and + only if all component flags of -ffast-math are set + to the value documented as the effect of -ffast-math.
    • +