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: 51 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a98:d5ce:0:b0:178:cc93:bf7d with SMTP id g14csp2413763eik; Tue, 19 Jul 2022 05:24:15 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u02HCpPNeXh8/Xt+cuowcmuasaP4ES00Hz/B2yNKfQMRF7pDM/6VjEIoT/BabEMMXDaCKs X-Received: by 2002:a17:907:a075:b0:72b:33e7:d63a with SMTP id ia21-20020a170907a07500b0072b33e7d63amr29410767ejc.533.1658233455782; Tue, 19 Jul 2022 05:24:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658233455; cv=none; d=google.com; s=arc-20160816; b=cG8eEc1cuA+4fINOakKYtIny5FulgpCfsSEMxFN80NhAKxB5yJR1nGib7aWhlqdnGS krRxZ1aofV0+G5gHcSNeOV8Sa4oTGT4A4bn2KIidPckeqQGZisXzM6FiakDG/NNchOH6 yPcuMDof7OlHyzY12dgb6Ab0ksQncJhgKnoVMfcI/y80GDb1VFuH3BWW5N8rhlouIJko Mnh8zJafXpXhKrSjoQS9EhXBOHZkzcVFCx+KQwCkbagTkjLGbD5t17DH46itsLc+i0DQ QGodHyZjKa06Oacdnkm+mjZvLk3qVnLQpYtIH+FJVLx7QOqKVfHa3eGeIru1XhMFe+Yp Do4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version:user-agent :message-id:subject:to:from:date:dkim-signature:dmarc-filter :delivered-to; bh=Z9jdbCX48d855aUOuhxWB0iUf1KPfaGnO9p59qR0PIE=; b=xhMhKDxwmi1eD6EzrfD9w2xOGK17LqKDySDhI0Rrr5LLkElCtubM+6xhHzgmhudHRf ygywyh5tG+Z1w4k5cM5jFd15OES+AkNAs17Y7sk/xCR0qxLVxhRwN3BxbDcCOhN/oJG5 EFqOriouFCvWXMWqOFF6K0PR/+R8SN5mn22/nCMmD20Pt1XPWt+RJp9LceTXjYu2kLXx sZrUnRHtulkPxdxr33EXmAW4BUQjhG9qMReJemvL5zFZXgNzNby151Ksd6VNf5CJrgFt R+lVdnrJcfsCbCAppsahgQaIpQSH3X182juiJXlwNpqtkQPqJIEeGPJYd+pr0L/PwapW 76qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b="E8/9nS6C"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id ji5-20020a170907980500b0072f22713ae6si11055130ejc.516.2022.07.19.05.24.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 05:24:15 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b="E8/9nS6C"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EB5F6385AE43 for ; Tue, 19 Jul 2022 12:24:08 +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-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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-LABELS: =?utf-8?b?IlxcSW1wb3J0YW50Ig==?= X-GMAIL-THRID: =?utf-8?q?1738783804478140603?= X-GMAIL-MSGID: =?utf-8?q?1738783804478140603?= 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