From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8568 invoked by alias); 20 Aug 2015 09:11:46 -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 8557 invoked by uid 89); 20 Aug 2015 09:11:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2 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 (CAMELLIA256-SHA encrypted) ESMTPS; Thu, 20 Aug 2015 09:11:44 +0000 Received: from ip-214.net-81-220-91.toulouse.rev.numericable.fr (HELO laptop-mg.local) ([81.220.91.214]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 20 Aug 2015 11:11:41 +0200 Date: Thu, 20 Aug 2015 09:18:00 -0000 From: Marc Glisse Reply-To: gcc-patches@gcc.gnu.org To: Richard Biener cc: GCC Patches , "Hurugalawadi, Naveen" Subject: Re: Move some flag_unsafe_math_optimizations using simplify and match In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-SW-Source: 2015-08/txt/msg01176.txt.bz2 On Thu, 20 Aug 2015, Richard Biener wrote: > On Thu, Aug 20, 2015 at 7:38 AM, Marc Glisse wrote: >> On Thu, 20 Aug 2015, Hurugalawadi, Naveen wrote: >> >>> The following testcase does not generate "x" as needed. >>> ==================== >>> double t (double x) >>> { >>> x = sqrt (x) * sqrt (x); >>> return x; >>> } >>> ==================== >> >> >> With -fno-math-errno, we CSE the calls to sqrt, so I would expect this to >> match: >> >> (mult (SQRT@1 @0) @1) >> >> Without the flag, I expect that one will apply >> >> (simplify >> (mult (SQRT:s @0) (SQRT:s @1)) >> (SQRT (mult @0 @1))) >> >> and then maybe we have something converting sqrt(x*x) to abs(x) or maybe >> not. > > ICK. I'd rather have CSE still CSE the two calls by adding some tricks > regarding to errno ... > >> I wonder if all the unsafe math optimizations are really ok without >> -fno-math-errno... > > Well, on GIMPLE they will preserve the original calls because of their > side-effects setting errno... on GENERIC probably not. But we are also introducing new math calls, and I am afraid those might set errno at an unexpected place in the code... I don't know if anyone interested in errno would ever use -funsafe-math-optimizations though. -- Marc Glisse