From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 117886 invoked by alias); 7 Jul 2018 11:31:14 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 117794 invoked by uid 89); 7 Jul 2018 11:31:03 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy= X-HELO: mail3-relais-sop.national.inria.fr Received: from mail3-relais-sop.national.inria.fr (HELO mail3-relais-sop.national.inria.fr) (192.134.164.104) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 07 Jul 2018 11:31:02 +0000 Received: from ip-33.net-89-2-166.rev.numericable.fr (HELO stedding) ([89.2.166.33]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Jul 2018 13:30:59 +0200 Date: Sat, 07 Jul 2018 11:31:00 -0000 From: Marc Glisse Reply-To: gcc-patches@gcc.gnu.org To: Jakub Jelinek cc: gcc-patches@gcc.gnu.org, Richard Biener Subject: Re: [PATCH] Don't fold nextafter/nexttoward if -ftrapping-math or -fmath-errno if they produce denormal results (PR c/86420) In-Reply-To: <20180707101258.GR7166@tucnak> Message-ID: References: <20180707080605.GP7166@tucnak> <20180707101258.GR7166@tucnak> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-SW-Source: 2018-07/txt/msg00357.txt.bz2 On Sat, 7 Jul 2018, Jakub Jelinek wrote: > On Sat, Jul 07, 2018 at 11:55:17AM +0200, Marc Glisse wrote: >> On Sat, 7 Jul 2018, Jakub Jelinek wrote: >> >>> 2018-07-07 Jakub Jelinek >>> >>> PR c/86420 >>> * real.c (real_nextafter): Return true if result is denormal. >> >> I have a question on the side: would it be hard / useful, in cases where >> nextafter may set errno or some exception flag, to fold the result to a >> constant while keeping the function call (ignoring the value it returns)? To >> clarify, I mean replace >> >> _2 = nextafter(DBL_DENORM_MIN, 0); >> >> with >> >> nextafter(DBL_DENORM_MIN, 0); >> _2 = 0; >> >> I think we already do that for some other calls, although I can't remember >> where. The point would be that we have the value of _2 and can keep folding >> its uses. > > For errno purposes alone that would be possible, but the function is marked > #define ATTR_MATHFN_ERRNO (flag_errno_math ? \ > ATTR_NOTHROW_LEAF_LIST : ATTR_CONST_NOTHROW_LEAF_LIST) > and thus with -ftrapping-math -fno-math-errno I'm afraid we'd immediately > DCE the call in the second form (without lhs). That looks like a problem we'll have to fix eventually. But not as part of this patch indeed. -- Marc Glisse