From patchwork Tue Jul 19 12:23:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 56156 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AF25C3851A89 for ; Tue, 19 Jul 2022 12:24:01 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by sourceware.org (Postfix) with ESMTPS id 568B4385742D for ; Tue, 19 Jul 2022 12:23:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 568B4385742D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-lf1-x12d.google.com with SMTP id z25so24508700lfr.2 for ; Tue, 19 Jul 2022 05:23:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:user-agent:mime-version; bh=Z9jdbCX48d855aUOuhxWB0iUf1KPfaGnO9p59qR0PIE=; b=E8/9nS6CGmELr2XVqC8kjrfpCxvi2TPjcVHtru1LCAcRgA/A8GAmDANssoC/dyBzR1 EHR+5Drr6TuTQaInaq5DtD7OK+8euaoiojacIEaex9+BnpjDfUVo/6Jll7QTGSO1MB/w PJMLqMnJouLkTu1/Y0yCjjeQcprVueva/66SIQh/+yUK7g1vtIKvXwMQI/nna6A5SIuR 3vEEw4iFbfsxMeVjfaIk30pVo1fNHlprvLjXqxLck7rupQNZmN9yrLe9pE0j/GLrFKFj BGBF1sd4qhC/0Og4iloXqLUd5dOxUGSs3k3QAZT+VjBKUxXWAF5ShaGchpGucJJ1DUhx XrDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:user-agent :mime-version; bh=Z9jdbCX48d855aUOuhxWB0iUf1KPfaGnO9p59qR0PIE=; b=mp4M0AggK+3u4Lo1fsEGC2cC+1uJcPEg9J6BB8+knPxv7/EJT69bzOcIolZTb+ebXT IfocIKXFKG1J5ZFY0rtFguwgogfmY3OSXbDd2+f1TMXXvTaAHsEs7ue7DRaHFejI8hQH 2uyHSqg8nQ4MzTilfLrNOmPtoWEupFotYdqJdCXtMWY3/W6pFa4u2J4k0CsYenvyNT21 h1XjbmOvM5kfxw6SQGfebscm1kp5/5CgudQ01cpr/NaGtNlYFbEHGKNOyGHGnmKrbcXQ RWZfgSxJBrVrH33XTrimBvKKMYfKqr3e0r2IILFSO/czQNjY9G5jgmJ3tkdG8eVbfDHA SW0g== X-Gm-Message-State: AJIora+ZbS26xR0ysDVWkZmXJ68eHiNlbZgePcLjnf3dK4FJGr4nownr I5ACwSklVmn2W4qy4fIv0VdLfkz3DidgcA== X-Google-Smtp-Source: AGRyM1sqzWoH90aQJiNUlPo3by7HrGGFvGummyTvNdodn/Jg4Q2ScjpTk8P1/+odMAzHFOck/c9N2w== X-Received: by 2002:a19:2d04:0:b0:482:e88a:b933 with SMTP id k4-20020a192d04000000b00482e88ab933mr18215488lfj.533.1658233419487; Tue, 19 Jul 2022 05:23:39 -0700 (PDT) Received: from [192.168.219.3] ([78.8.192.131]) by smtp.gmail.com with ESMTPSA id f8-20020a05651232c800b004894b6df9e2sm3166469lfg.114.2022.07.19.05.23.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Jul 2022 05:23:38 -0700 (PDT) Date: Tue, 19 Jul 2022 13:23:33 +0100 (BST) From: "Maciej W. Rozycki" To: gcc-patches@gcc.gnu.org Subject: [PATCH] doc: Clarify FENV_ACCESS pragma semantics WRT `-ftrapping-math' Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_ASCII_DIVIDERS, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: , Cc: Joseph Myers Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Our documentation indicates that it is the `-frounding-math' invocation option that controls whether we respect what the FENV_ACCESS pragma would imply, should we implement it, regarding the floating point environment. It is only a part of the picture however, because the `-ftrapping-math' invocation option also affects how we handle said environment. Clarify that in the description of both options then, as well as the FENV_ACCESS pragma itself. gcc/ * doc/implement-c.texi (Floating point implementation): Mention `-fno-trapping-math' in the context of FENV_ACCESS pragma. * doc/invoke.texi (Optimize Options): Clarify FENV_ACCESS pragma implication in the descriptions of `-fno-trapping-math' and `-frounding-math'. --- Hi, Discovered in the course of investigating RISC-V unordered comparisons, c.f. . Maciej --- gcc/doc/implement-c.texi | 3 ++- gcc/doc/invoke.texi | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) gcc-doc-fenv-access-trapping.diff Index: gcc/gcc/doc/implement-c.texi =================================================================== --- gcc.orig/gcc/doc/implement-c.texi +++ gcc/gcc/doc/implement-c.texi @@ -339,7 +339,8 @@ This is subject to change. 7.6.1).} This pragma is not implemented, but the default is to ``off'' unless -@option{-frounding-math} is used in which case it is ``on''. +@option{-frounding-math} is used and @option{-fno-trapping-math} is not +in which case it is ``on''. @item @cite{Additional floating-point exceptions, rounding modes, environments, Index: gcc/gcc/doc/invoke.texi =================================================================== --- gcc.orig/gcc/doc/invoke.texi +++ gcc/gcc/doc/invoke.texi @@ -13513,6 +13513,11 @@ math functions. The default is @option{-ftrapping-math}. +Future versions of GCC may provide finer control of this setting +using C99's @code{FENV_ACCESS} pragma. This command-line option +will be used along with @option{-frounding-math} to specify the +default state for @code{FENV_ACCESS}. + @item -frounding-math @opindex frounding-math Disable transformations and optimizations that assume default floating-point @@ -13531,7 +13536,8 @@ This option is experimental and does not disable all GCC optimizations that are affected by rounding mode. Future versions of GCC may provide finer control of this setting using C99's @code{FENV_ACCESS} pragma. This command-line option -will be used to specify the default state for @code{FENV_ACCESS}. +will be used along with @option{-ftrapping-math} to specify the +default state for @code{FENV_ACCESS}. @item -fsignaling-nans @opindex fsignaling-nans