From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10729 invoked by alias); 27 May 2011 13:45:50 -0000 Received: (qmail 10721 invoked by uid 22791); 27 May 2011 13:45:49 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,MAY_BE_FORGED,TW_FN,TW_TM,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e33.co.us.ibm.com (HELO e33.co.us.ibm.com) (32.97.110.151) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 27 May 2011 13:45:35 +0000 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e33.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id p4RDcIbw011529 for ; Fri, 27 May 2011 07:38:18 -0600 Received: from d03av05.boulder.ibm.com (d03av05.boulder.ibm.com [9.17.195.85]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id p4RDjPkL147174 for ; Fri, 27 May 2011 07:45:29 -0600 Received: from d03av05.boulder.ibm.com (loopback [127.0.0.1]) by d03av05.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p4RDjO98014339 for ; Fri, 27 May 2011 07:45:24 -0600 Received: from [9.10.86.209] (tepot-pc.rchland.ibm.com [9.10.86.209] (may be forged)) by d03av05.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p4RDjOIn013653; Fri, 27 May 2011 07:45:24 -0600 Subject: Re: [PATCH] More pow(x,c) expansions in cse_sincos pass (PR46728, patch 3) From: "William J. Schmidt" To: Richard Guenther Cc: gcc-patches@gcc.gnu.org In-Reply-To: References: <1306345412.4821.56.camel@L3G5336.ibm.com> <1306432259.4821.73.camel@L3G5336.ibm.com> Content-Type: text/plain Date: Fri, 27 May 2011 14:22:00 -0000 Message-Id: <1306503916.4821.77.camel@L3G5336.ibm.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit 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 X-SW-Source: 2011-05/txt/msg02165.txt.bz2 On Fri, 2011-05-27 at 12:24 +0200, Richard Guenther wrote: > Now, the tree_expr_nonnegative_p check will always return false > because arg0 is a gimple value. We would need to implement > either some propagation engine to derive properties for floating > point entities or mimic what tree_expr_nonnegative_p does by > looking at defining statements. A very simple variant could be > like > > bool > gimple_val_nonnegative_p (tree val) > { > if (tree_expr_nonnegative_p (val)) > return true; > > if (TREE_CODE (val) == SSA_NAME) > { > gimple def_stmt = SSA_NAME_DEF_STMT (val); > if (is_gimple_assign (def_stmt)) > return gimple_assign_rhs_code (def_stmt) == ABS_EXPR; > else if (is_gimple_call (def_stmt)) > { > tree fndecl = gimple_call_fndecl (def_stmt); > if (fndecl > && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL) > { > switch (DECL_FUNCTION_CODE (fndecl)) > { > CASE_FLT_FN (BUILT_IN_FABS): > return true; > default:; > } > } > } > } > > return false; > } > > suitable for gimple-fold.c. > > Alternatively you can drop the call and add a FIXME comment. > > > + > > + /* Optimize pow(x,1./6.) = cbrt(sqrt(x)). Don't do this optimization > > + if we don't have a hardware sqrt insn. */ > > + dconst1_6 = dconst1_3; > > + SET_REAL_EXP (&dconst1_6, REAL_EXP (&dconst1_6) - 1); > > + > > + if (flag_unsafe_math_optimizations > > + && sqrtfn > > + && cbrtfn > > + && (tree_expr_nonnegative_p (arg0) || !HONOR_NANS (mode)) > > Likewise. OK, sounds good. I will commit this patch with the FIXME comments, and test the gimple_val_nonnegative_p changes next week after the holiday. Thanks, Bill