public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Sudi Das <Sudi.Das@arm.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	       Marcus Shawcroft <Marcus.Shawcroft@arm.com>,
	       Richard Earnshaw <Richard.Earnshaw@arm.com>,
	       James Greenhalgh <James.Greenhalgh@arm.com>,
	nd <nd@arm.com>
Subject: Re: [PATCH][GCC] Simplification of 1U << (31 - x)
Date: Wed, 12 Apr 2017 17:06:00 -0000	[thread overview]
Message-ID: <20170412170638.GA1809@tucnak> (raw)
In-Reply-To: <VI1PR08MB26887B0900BF829A25462F0698000@VI1PR08MB2688.eurprd08.prod.outlook.com>

On Wed, Apr 12, 2017 at 09:29:55AM +0000, Sudi Das wrote:
> Hi all
> 
> This is a fix for PR 80131 
> Currently the code A << (B - C) is not simplified.
> However at least a more specific case of 1U << (C -x) where C = precision(type) - 1 can be simplified to (1 << C) >> x.

Is that always a win though?
Some constants have higher costs than others on various targets, some
significantly higher.  This change might be beneficial only
if if C is as expensive as 1, then you get rid of a one (typically cheap)
operation.
Which makes me wonder whether this should be done at GIMPLE time and not
at RTL time (expansion or combine etc.) when one can compare the RTX costs.
Or do this at match.pd as canonicalization and then have RTL transformation
to rewrite such (1U << C) >> X as 1U << (C - X) if the latter is faster (or
shorter).

	Jakub

  reply	other threads:[~2017-04-12 17:06 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-12  9:30 Sudi Das
2017-04-12 17:06 ` Jakub Jelinek [this message]
2017-04-12 18:16   ` Segher Boessenkool
2017-04-12 18:59     ` Jakub Jelinek
2017-04-12 19:34       ` Segher Boessenkool
2017-04-13 11:16 Wilco Dijkstra
2017-04-13 11:21 ` Jakub Jelinek
2017-04-13 11:33   ` Wilco Dijkstra
2017-04-13 11:41     ` Jakub Jelinek
2017-04-13 11:49       ` Richard Biener
2017-04-13 11:55         ` Jakub Jelinek
2017-04-13 12:01         ` Wilco Dijkstra
2017-08-01  9:15           ` Sudi Das
2017-08-04 10:16             ` Richard Biener
2017-09-26 12:44               ` Sudi Das
2017-09-26 13:06                 ` Jakub Jelinek
2017-09-26 13:20                   ` Wilco Dijkstra
2017-10-06 17:00                     ` Sudi Das
2017-10-09 12:05                 ` Richard Biener
2017-10-09 13:04                   ` Wilco Dijkstra
2017-10-10 11:12                     ` Sudi Das
2017-11-07 12:37                       ` Wilco Dijkstra
2017-11-07 14:48                         ` Christophe Lyon
2017-11-07 14:49                           ` Wilco Dijkstra

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=20170412170638.GA1809@tucnak \
    --to=jakub@redhat.com \
    --cc=James.Greenhalgh@arm.com \
    --cc=Marcus.Shawcroft@arm.com \
    --cc=Richard.Earnshaw@arm.com \
    --cc=Sudi.Das@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=nd@arm.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).