From patchwork Thu Aug 22 13:45:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 1151611 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-507515-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="bo9YGSkV"; dkim-atps=neutral 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 46Dm5y0kj0z9s00 for ; Thu, 22 Aug 2019 23:46:29 +1000 (AEST) 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:date:in-reply-to:references:mime-version :content-transfer-encoding:message-id; q=dns; s=default; b=PneR7 F+F3DGZzpyF4NlRVd7IRma/729vB4dMI0XZ4ddny0om0qZz4CaprFz58zYCq3NXY XbyOTT0MfwA0E2bWJRCiTfjqpRGoloZvSkuErsQIH1pA2dBBID48ePwg+JrRmTWr 4x0/LsgFO7rclvyrp9w1h3sPTJMuTJm43xBYsE= 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:date:in-reply-to:references:mime-version :content-transfer-encoding:message-id; s=default; bh=ihOnT7JrPpb Ug9EDSuVtseyl9Ks=; b=bo9YGSkVPtniXmWh5leNFhZQEMfH8V4S1GCKzqPotKk GTqaW9UkP3nYSECgk7nkNZP5M/a65rbphfI8iJ4UBtFrAqAFJtuvTxhvxptDz03r mJYOD5mLBybFZpTI8S42wsxyRtQP6Qb965FByfdJO0XXSOaUst2x34Nk5mJP1CX8 = Received: (qmail 70928 invoked by alias); 22 Aug 2019 13:46:18 -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 70814 invoked by uid 89); 22 Aug 2019 13:46:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy=Ilya, interpreted, unordered, sk:iiilin X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 22 Aug 2019 13:46:15 +0000 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x7MDXpdQ096684 for ; Thu, 22 Aug 2019 09:46:13 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2uhu2ckgm4-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 22 Aug 2019 09:46:13 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 22 Aug 2019 14:46:11 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 22 Aug 2019 14:46:09 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x7MDk8Fg48169124 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Aug 2019 13:46:08 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 69E4C42045; Thu, 22 Aug 2019 13:46:08 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3B6A842047; Thu, 22 Aug 2019 13:46:08 +0000 (GMT) Received: from white.boeblingen.de.ibm.com (unknown [9.152.99.241]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 22 Aug 2019 13:46:08 +0000 (GMT) From: Ilya Leoshkevich To: gcc-patches@gcc.gnu.org Cc: richard.sandiford@arm.com, segher@kernel.crashing.org, Ilya Leoshkevich Subject: [PATCH v2 1/9] Document signaling for min, max and ltgt operations Date: Thu, 22 Aug 2019 15:45:43 +0200 In-Reply-To: <20190822134551.18924-1-iii@linux.ibm.com> References: <20190822134551.18924-1-iii@linux.ibm.com> MIME-Version: 1.0 x-cbid: 19082213-0016-0000-0000-000002A1843E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19082213-0017-0000-0000-00003301BDBC Message-Id: <20190822134551.18924-2-iii@linux.ibm.com> X-IsSubscribed: yes Currently it's not clear whether min, max and ltgt should raise floating point exceptions when dealing with qNaNs. Right now a lot of code assumes that LTGT is signaling: in particular, with -fno-finite-math-only, which is the default, it's generated for the signaling ((x < y) || (x > y)). The behavior of MIN/MAX is (intentionally?) left unspecified, according to https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=263751 ("Unconditionally use MAX_EXPR/MIN_EXPR for MAX/MIN intrinsics"). So document the status quo. gcc/ChangeLog: 2019-08-09 Ilya Leoshkevich PR target/91323 * doc/generic.texi (LTGT_EXPR): Restore the original wording regarding floating point exceptions. (MIN_EXPR, MAX_EXPR): Document. * doc/md.texi (smin, smax): Add a clause regarding floating point exceptions. * doc/rtl.texi (smin, smax): Add a clause regarding floating point exceptions. --- gcc/doc/generic.texi | 16 +++++++++++++--- gcc/doc/md.texi | 3 ++- gcc/doc/rtl.texi | 3 ++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/gcc/doc/generic.texi b/gcc/doc/generic.texi index 8901d5f357e..d5ae20bd461 100644 --- a/gcc/doc/generic.texi +++ b/gcc/doc/generic.texi @@ -1331,6 +1331,8 @@ the byte offset of the field, but should not be used directly; call @tindex UNGE_EXPR @tindex UNEQ_EXPR @tindex LTGT_EXPR +@tindex MIN_EXPR +@tindex MAX_EXPR @tindex MODIFY_EXPR @tindex INIT_EXPR @tindex COMPOUND_EXPR @@ -1602,13 +1604,21 @@ These operations take two floating point operands and determine whether the operands are unordered or are less than, less than or equal to, greater than, greater than or equal to, or equal respectively. For example, @code{UNLT_EXPR} returns true if either operand is an IEEE -NaN or the first operand is less than the second. With the possible -exception of @code{LTGT_EXPR}, all of these operations are guaranteed -not to generate a floating point exception. The result +NaN or the first operand is less than the second. Only @code{LTGT_EXPR} +is expected to raise an invalid floating-point-operation trap when the +outcome is unordered. All other operations are guaranteed not to raise +a floating point exception. The result type of these expressions will always be of integral or boolean type. These operations return the result type's zero value for false, and the result type's one value for true. +@item MIN_EXPR +@itemx MAX_EXPR +These nodes represent minimum and maximum operations. When used with +floating point, if both operands are zeros, or if either operand is +@code{NaN}, then it is unspecified which of the two operands is returned +as the result and whether or not a floating point exception is raised. + @item MODIFY_EXPR These nodes represent assignment. The left-hand side is the first operand; the right-hand side is the second operand. The left-hand side diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index 7751984bf5f..74f8ec84974 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -5353,7 +5353,8 @@ in the rtl as @item @samp{smin@var{m}3}, @samp{smax@var{m}3} Signed minimum and maximum operations. When used with floating point, if both operands are zeros, or if either operand is @code{NaN}, then -it is unspecified which of the two operands is returned as the result. +it is unspecified which of the two operands is returned as the result +and whether or not a floating point exception is raised. @cindex @code{fmin@var{m}3} instruction pattern @cindex @code{fmax@var{m}3} instruction pattern diff --git a/gcc/doc/rtl.texi b/gcc/doc/rtl.texi index 0814b66a486..e0628da893d 100644 --- a/gcc/doc/rtl.texi +++ b/gcc/doc/rtl.texi @@ -2596,7 +2596,8 @@ Represents the smaller (for @code{smin}) or larger (for @code{smax}) of @var{x} and @var{y}, interpreted as signed values in mode @var{m}. When used with floating point, if both operands are zeros, or if either operand is @code{NaN}, then it is unspecified which of the two operands -is returned as the result. +is returned as the result and whether or not a floating point exception +is raised. @findex umin @findex umax