public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Eric Botcazou <ebotcazou@adacore.com>
To: Maxim Kuvyrkov <maxim@codesourcery.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Improve combining of conditionals
Date: Fri, 15 Apr 2011 09:27:00 -0000	[thread overview]
Message-ID: <201104151104.44739.ebotcazou@adacore.com> (raw)
In-Reply-To: <33F4E740-6ED2-4694-B63C-E43ED3B91461@codesourcery.com>

> 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

  reply	other threads:[~2011-04-15  9:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-15  7:59 Maxim Kuvyrkov
2011-04-15  9:27 ` Eric Botcazou [this message]
2011-04-15 10:49   ` Steven Bosscher
2011-04-15 10:54     ` Maxim Kuvyrkov
2011-04-15 11:14     ` Eric Botcazou
2011-04-15 16:55       ` Mike Stump
2011-04-15 17:52         ` Eric Botcazou
2011-04-15 18:16           ` Mike Stump
2011-04-15 12:31 ` Eric Botcazou
2011-04-15 12:41   ` Maxim Kuvyrkov
2011-04-25 15:32     ` Maxim Kuvyrkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201104151104.44739.ebotcazou@adacore.com \
    --to=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=maxim@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).