From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21522 invoked by alias); 20 Aug 2015 05:38:33 -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 21465 invoked by uid 89); 20 Aug 2015 05:38:29 -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 05:38:28 +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 07:38:24 +0200 Date: Thu, 20 Aug 2015 06:20:00 -0000 From: Marc Glisse Reply-To: gcc-patches@gcc.gnu.org To: "Hurugalawadi, Naveen" cc: Richard Biener , "gcc-patches@gcc.gnu.org" 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/msg01158.txt.bz2 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. I wonder if all the unsafe math optimizations are really ok without -fno-math-errno... -- Marc Glisse