From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 76901 invoked by alias); 20 Aug 2015 08:20:38 -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 76889 invoked by uid 89); 20 Aug 2015 08:20:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-io0-f169.google.com Received: from mail-io0-f169.google.com (HELO mail-io0-f169.google.com) (209.85.223.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 20 Aug 2015 08:20:33 +0000 Received: by iods203 with SMTP id s203so37928824iod.0 for ; Thu, 20 Aug 2015 01:20:31 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.107.167.199 with SMTP id q190mr1865263ioe.119.1440058831860; Thu, 20 Aug 2015 01:20:31 -0700 (PDT) Received: by 10.107.32.140 with HTTP; Thu, 20 Aug 2015 01:20:31 -0700 (PDT) In-Reply-To: References: Date: Thu, 20 Aug 2015 08:22:00 -0000 Message-ID: Subject: Re: Move some flag_unsafe_math_optimizations using simplify and match From: Richard Biener To: GCC Patches Cc: "Hurugalawadi, Naveen" Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-08/txt/msg01166.txt.bz2 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. Richard. > -- > Marc Glisse