From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sourceware.org (Postfix) with ESMTPS id 645813858D1E; Thu, 1 Sep 2022 15:57:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 645813858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=inria.fr Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=inria.fr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=date:from:reply-to:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=pptx7B2iTqZ0CMLyjiXbTc+wxp5Bm2oS962+OT/5rsU=; b=WKiGmvU45zhm2TYm79IV5GPLaaw8J2hul0FIaZ76Dp7AGhGwuQH5PRmU hyqkXSO5qoyWyieAkFwr5ZuczHxU7XHG6lIxAraeCPZOxVIZpRkPR3DRg Mxq0jusRyLFdidD75vitC3tosPA1q14ISgojzdqdxH5ZXgHH3ULvWDf/y 0=; Authentication-Results: mail2-relais-roc.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=marc.glisse@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="5.93,281,1654552800"; d="scan'208";a="50919802" Received: from 85-171-187-240.rev.numericable.fr (HELO hippo) ([85.171.187.240]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Sep 2022 17:57:22 +0200 Date: Thu, 1 Sep 2022 17:57:21 +0200 (CEST) From: Marc Glisse Reply-To: gcc@gcc.gnu.org To: Joseph Myers cc: FX , Jakub Jelinek , gcc@gcc.gnu.org, FX via Fortran Subject: Re: Floating-point comparisons in the middle-end In-Reply-To: Message-ID: References: <8C6DDAA3-A40F-47C7-BE78-D56A3EC70C71@gmail.com> <3BD50DD7-5C9E-42CB-992C-A66584411A4F@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, 1 Sep 2022, Joseph Myers wrote: > On Thu, 1 Sep 2022, FX via Gcc wrote: > >> A tentative patch is attached, it seems to work well on simple examples, >> but for test coverage the hard part is going to be that the comparisons >> seem to be optimised away very easily into their non-signaling versions. >> Basically, if I do: > > Presumably that can be reproduced without depending on the new built-in > function? In which case it's an existing bug somewhere in the optimizers. (simplify (cmp @0 REAL_CST@1) [...] (if (REAL_VALUE_ISNAN (TREE_REAL_CST (@1)) && !tree_expr_signaling_nan_p (@1) && !tree_expr_maybe_signaling_nan_p (@0)) { constant_boolean_node (cmp == NE_EXPR, type); }) only tries to preserve a comparison with sNaN, but not with qNaN. There are probably other issues since various gcc devs used to have a different opinion on the meaning of -ftrapping-math. -- Marc Glisse