From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id 91DA33858010 for ; Fri, 27 Nov 2020 20:31:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 91DA33858010 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=joseph_myers@mentor.com IronPort-SDR: MaEWP3PBoQrdhGjPyGlPs93fQTYEWHE3HipOhI7rlG2STj7ZuoE9FM2XFUPLAJsx34eFBr5Z2R GVYdP6RvpXnX39SbvuU7lyMsdE8KbZ8CzAvNv/WVKaLorTuGKJiibE9/o+nt4+oj71MzqmBpYT TBg9zns2NyrIJnM0qIIgQZohhblLqZeflhdodcZL6evBq5BJxKmJ6KBFRWMvNqd+dIC3KtJ5om jERW1ksBtgpReeXDbGNKEkJvEvYt/heBjigfnDIcS6qGP2iknBPYYiFVuOnbBuc1iqdf1rfcJX mP0= X-IronPort-AV: E=Sophos;i="5.78,375,1599552000"; d="scan'208";a="55567672" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 27 Nov 2020 12:31:40 -0800 IronPort-SDR: T1dKoXnX92bbvVONtW8pkyaYE51+9ZGhByboHw9tIpAR8uNYXfFR6BuRZsN0Q7/fANMMRUNW5P i55KNWmnHGqnyy38Z2J5pUpDrCq5CgE9cHuAX09qVo43al2MiC7GjSgFKz1fLG+bnFVQa9ZHc+ +8bR2rsl5EMS9OoSnCXgSabwvitEsr50SWASOjoup9xeSMttADAONiU6Q8/Z1AoTaXxsGeD5qt FS0VZgPYFtxgwPfjnmmQYBnzAkMQuJ+gSsQ3z1Eb6J9P9FOb+BzWc3kavSOJvl6rYutj/ltNWU qCY= Date: Fri, 27 Nov 2020 20:31:34 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: Richard Biener CC: Jakub Jelinek , Subject: Re: [PATCH] fold-const: Don't consider NaN non-negative [PR97965] In-Reply-To: Message-ID: References: <20201126083155.GN3788@tucnak> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-09.mgc.mentorg.com (139.181.222.9) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-3125.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no 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-List-Received-Date: Fri, 27 Nov 2020 20:31:42 -0000 On Thu, 26 Nov 2020, Richard Biener wrote: > Is copysign (x, NaN) supposed to be well-defined? We'd stop folding copysign with NaN arguments (including sNaN) is well-defined and copies the sign bit without raising any exceptions. > this then, no? I think the ABS_EXPR < 0 to false folding is > simply incomplete and should first check whether the operands are > ordered? That said, NaN is nonnegative but NaN < 0 isn't false(?) Comparisons involving NaN with < <= > >= == all return false. For example, with -fno-trapping-math, it's valid to fold fabs (anything) < 0 to false (preserving any side effects from evaluating "anything"), but it's not valid to fold fabs (anything) >= 0 to true, because NaN < 0 and NaN >= 0 are both false. With -ftrapping-math, neither can be folded if the argument might be a NaN. -- Joseph S. Myers joseph@codesourcery.com