From: Bernd Schmidt <bschmidt@redhat.com>
To: vogt@linux.vnet.ibm.com, gcc-patches@gcc.gnu.org,
Andreas Krebbel <krebbel@linux.vnet.ibm.com>,
Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Subject: Re: [PATCH] Do not simplify "(and (reg) (const bit))" to if_then_else.
Date: Thu, 01 Dec 2016 12:33:00 -0000 [thread overview]
Message-ID: <9044f460-61af-3680-4ac4-5ac9d7ead673@redhat.com> (raw)
In-Reply-To: <20161121123647.GA22233@linux.vnet.ibm.com>
On 11/21/2016 01:36 PM, Dominik Vogt wrote:
> diff --git a/gcc/combine.c b/gcc/combine.c
> index b22a274..457fe8a 100644
> --- a/gcc/combine.c
> +++ b/gcc/combine.c
> @@ -5575,10 +5575,23 @@ combine_simplify_rtx (rtx x, machine_mode op0_mode, int in_dest,
> {
> rtx cop1 = const0_rtx;
> enum rtx_code cond_code = simplify_comparison (NE, &cond, &cop1);
> + unsigned HOST_WIDE_INT nz;
>
> if (cond_code == NE && COMPARISON_P (cond))
> return x;
>
> + /* If the operation is an AND wrapped in a SIGN_EXTEND or ZERO_EXTEND
> + with either operand being just a constant single bit value, do
> + nothing since IF_THEN_ELSE is likely to increase the expression's
> + complexity. */
> + if (HWI_COMPUTABLE_MODE_P (mode)
> + && pow2p_hwi (nz = nonzero_bits (x, mode))
> + && ! ((code == SIGN_EXTEND || code == ZERO_EXTEND)
> + && GET_CODE (XEXP (x, 0)) == AND
> + && CONST_INT_P (XEXP (XEXP (x, 0), 0))
> + && UINTVAL (XEXP (XEXP (x, 0), 0)) == nz))
> + return x;
It looks like this doesn't actually use cond or true/false_rtx. So this
could be placed just above the call to if_then_else_cond to avoid
unnecessary work. Ok if that works.
Bernd
next prev parent reply other threads:[~2016-12-01 12:33 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-31 19:56 Dominik Vogt
2016-11-07 15:57 ` [PING, PATCH] " Dominik Vogt
2016-11-07 20:29 ` [PATCH] " Bernd Schmidt
2016-11-11 11:10 ` Dominik Vogt
2016-11-21 12:36 ` Dominik Vogt
2016-12-01 12:19 ` [PING] " Dominik Vogt
2016-12-01 12:33 ` Bernd Schmidt [this message]
2016-12-01 15:30 ` [PATCH v3] " Dominik Vogt
2016-12-02 8:36 ` Andreas Krebbel
2016-12-03 16:35 ` Andreas Schwab
2016-12-04 1:19 ` Segher Boessenkool
2016-12-05 9:22 ` Dominik Vogt
2016-12-05 10:01 ` Segher Boessenkool
2016-12-05 10:50 ` Dominik Vogt
2016-12-05 13:31 ` Oleg Endo
2016-12-05 13:57 ` Segher Boessenkool
2016-12-05 14:00 ` Dominik Vogt
2016-12-01 23:49 ` [PATCH] " Jeff Law
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=9044f460-61af-3680-4ac4-5ac9d7ead673@redhat.com \
--to=bschmidt@redhat.com \
--cc=Ulrich.Weigand@de.ibm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=krebbel@linux.vnet.ibm.com \
--cc=vogt@linux.vnet.ibm.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).