From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id 1CBC63858D39; Thu, 30 Dec 2021 18:42:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1CBC63858D39 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: RCv7HcOh3ekWBx7MkBHyr4asXuDP//tLgsJhWBZ8Js3LYZM7E7hMJwVaUgEBHe4Owe6bQclp7U AEmAlQFiigUl1ABpWjxeO95qyfOKma0xhi54OyXpZSAwRHRxraRilDEuaw4Fyh1ZDtNIrHz3q2 O6dnLetIlAbErqm9kYIIhuRVXB0uX3zuCUMNYUJnFBxtULmtxHD7NbPrLir5XTbnCkIch9/zOl F8lYuM+44B2e7Y8eQoRXrJuLNPw7aRoMv+Tfu3ZLbH0pnqstpBoZYo3mzpKzDCUSj+KStLXDoP QUU8RuCiCGP7itAz5bV3RYX1 X-IronPort-AV: E=Sophos;i="5.88,248,1635235200"; d="scan'208";a="70107094" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 30 Dec 2021 10:42:22 -0800 IronPort-SDR: jR7yVzCgPMWq8ozcI+5NCumvsV/yAsJXx3AbjdKRweV7jW8ApgLcyHO9GSwE94KJxybyY3GQnh +i+iFnY3fc15nQe6WuUW6bpBaJ3gVRghdglUnPa/FkJFVwqvrhzutvLoUjcFy6/AtWq4UYMgD4 ETBSczrdGB+/jVm4rxYLUtAU1nhDpZRKmgeIi+AJd3WkmNN1ykbQRFk6Zk6L6yzs/sace5wU1z sqGsh8YZk+HT9TnVB6X53tYE6R+VF+kxB8uCo5vjOeymMyc32RzJZhGMzglcJNMytZjfU3KRPH D8M= Date: Thu, 30 Dec 2021 18:42:15 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: FX CC: GCC Mailing List , Subject: Re: Need for __builtin_issignaling() In-Reply-To: <8ABA7142-4AF1-4857-89AA-40471703F95A@gmail.com> Message-ID: References: <8ABA7142-4AF1-4857-89AA-40471703F95A@gmail.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-3115.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8BIT X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Dec 2021 18:42:24 -0000 On Wed, 29 Dec 2021, FX via Gcc wrote: > Is it particularly hard to do? I came across a post in the list archives > from Joseph, who said it would be good to have. I’d be willing to try > and put something together, unless you think it’s a big project. Any > pointers as to how to start would be appreciated. Start by looking at Tamar Christina's patch for bugs 77925, 77926, 66462, which got reverted because of problems it caused. In particular, see my comment 18 in bug 66462 pointing to some of the reports of issues, and look at the relevant discussion in June 2017. I think the following comment 19 is incorrect (when it refers to June and November, those are June 2017 and November 2016, so the November version is an *older* one, but that comments is under the apprehension that it was a newer one). There's no need to use that patch as a starting point, but it may well be helpful to do so, or at least to get ideas from it. It didn't add __builtin_issignaling, but did add implementations of other related built-in functions based on bit-manipulation, and __builtin_issignaling would need to be implemented based on such bit-manipulation. Apart from avoiding the bugs in that patch, for __builtin_issignaling there isn't any other implementation approach to fall back on, and there isn't any defined external-linkage function to fall back on either. So it's strongly desirable to have a built-in function that works (is expanded inline) for *all* floating-point formats supported by GCC, not just some. (For formats not supporting signaling NaNs, it can trivially return 0 after evaluating the argument for its side effects.) Note that supporting all formats includes working for formats where integer arithmetic on a same-size integer isn't supported (TFmode on 32-bit architectures where there isn't TImode integer arithmetic, in particular), so you need to be careful about working correctly in that case. -- Joseph S. Myers joseph@codesourcery.com