From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17441 invoked by alias); 15 Apr 2011 09:10:25 -0000 Received: (qmail 17431 invoked by uid 22791); 15 Apr 2011 09:10:24 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 15 Apr 2011 09:10:17 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id B9E14CB03BA; Fri, 15 Apr 2011 11:10:14 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qXOXcDnGdHDB; Fri, 15 Apr 2011 11:10:11 +0200 (CEST) Received: from [192.168.1.2] (bon31-9-83-155-120-49.fbx.proxad.net [83.155.120.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id AC4B7CB03C3; Fri, 15 Apr 2011 11:10:08 +0200 (CEST) From: Eric Botcazou To: Maxim Kuvyrkov Subject: Re: [PATCH] Improve combining of conditionals Date: Fri, 15 Apr 2011 09:27:00 -0000 User-Agent: KMail/1.9.9 Cc: gcc-patches@gcc.gnu.org References: <33F4E740-6ED2-4694-B63C-E43ED3B91461@codesourcery.com> In-Reply-To: <33F4E740-6ED2-4694-B63C-E43ED3B91461@codesourcery.com> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <201104151104.44739.ebotcazou@adacore.com> Content-Type: text/plain; charset="iso-8859-1" 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-04/txt/msg01157.txt.bz2 > The patch was successfully tested on {i686, arm, mips}-linux, both GCC > testsuites and SPEC2000 runs. For all targets there was no observable code > difference in SPEC2000 benchmarks, so the example does not trigger very > often. Still, it speeds up CoreMark by about 1%. > > OK for trunk? Yes, modulo the following nits: @@ -4938,11 +4938,13 @@ find_split_point (rtx *loc, rtx insn, bool set_src) IN_DEST is nonzero if we are processing the SET_DEST of a SET. + IN_COND is nonzero if we are on top level of the condition. "...we are at the top level of a condition." @@ -5221,10 +5225,12 @@ subst (rtx x, rtx from, rtx to, int in_dest, int unique_copy) expression. OP0_MODE is the original mode of XEXP (x, 0). IN_DEST is nonzero - if we are inside a SET_DEST. */ + if we are inside a SET_DEST. IN_COND is nonzero if we are on the top level + of a condition. */ Likewise. @@ -5717,7 +5723,16 @@ combine_simplify_rtx (rtx x, enum machine_mode op0_mode, int in_dest) ZERO_EXTRACT is indeed appropriate, it will be placed back by the call to make_compound_operation in the SET case. */ - if (STORE_FLAG_VALUE == 1 + if (in_cond) + /* Don't apply below optimizations if the caller would + prefer a comparison rather than a value. + E.g., for the condition in an IF_THEN_ELSE most targets need + an explicit comparison. */ + { + ; + } Remove the superfluous parentheses and move the comment to a new paragraph of the big comment just above. No need to retest, just make sure this still compiles, thanks in advance. -- Eric Botcazou