public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Michael Matz <matz@suse.de>
To: Richard Sandiford <rdsandiford@googlemail.com>
Cc: Paolo Bonzini <bonzini@gnu.org>,
		Richard Guenther <richard.guenther@gmail.com>,
		gcc-patches@gcc.gnu.org
Subject: Re: RFC patch: invariant addresses too cheap
Date: Sat, 31 Oct 2009 19:23:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.64.0910312002130.15566@wotan.suse.de> (raw)
In-Reply-To: <878werq41v.fsf@firetop.home>

Hi,

On Sat, 31 Oct 2009, Richard Sandiford wrote:

> Paolo Bonzini <bonzini@gnu.org> writes:
> >> As of using a magic number there,
> >> another option would be to have a new target macro specifying
> >> CHEAP_ADDRESS_COST or sth like that...
> >
> > That would be premature.  The optimization was introduced specifically
> > for x86, any other target probably does not care (surely not the RISC
> > ones that always have COSTS_N_INSNS(1) for the address_cost).
> 
> I don't understand why it would be premature.  As Michael says, some 
> ports don't a COSTS_N_INSNS-based value, and MIPS is one of those.  As 
> it happens, in the MIPS costs, 1 is "cheap" and 2+ is "expensive".

So that wouldn't have made a difference with the old magic number (which 
was 4) ;-)

> So either I need to hack MIPS so that 2 is cheap and 3+ is "expensive", 
> or we need some better way of determining this.

Yeah, actually that we need to determine absolute address cheapness at all 
is a bit unsatisfying.  We probably could get away with a target 
independend notion of when to hoist invariant addresses.  For instance, if 
it has two register references, those registers are only used in this 
address, then it's always a win to hoist (because it reduces register 
pressure by one).  Then we obviously have the problem what to do with 
offsetted addresses, some of them are cheap (small constants), some of 
them expensive (large constant), but that's target dependend.

I don't really see a good way out here, except sitting down, redefining 
the target address cost hook (so that it's usable in its two contextes 
it's used in now, relative cost comparisons and absolute ones), and make 
all targets follow that.  I chickened out then :-)


Ciao,
Michael.

  parent reply	other threads:[~2009-10-31 19:18 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-19 16:17 Michael Matz
2009-10-19 16:45 ` Paolo Bonzini
2009-10-20  9:04   ` Richard Guenther
2009-10-20 12:07     ` Paolo Bonzini
2009-10-20 16:00       ` Michael Matz
2009-10-20 16:06         ` Richard Guenther
2009-10-31 10:05       ` Richard Sandiford
2009-10-31 11:14         ` Paolo Bonzini
2009-10-31 11:16           ` Richard Guenther
2009-10-31 12:56             ` Paolo Bonzini
2009-10-31 13:53               ` Richard Sandiford
2009-10-31 14:31                 ` Paolo Bonzini
2009-11-01 10:24                   ` Richard Sandiford
2009-11-01 10:25                     ` Paolo Bonzini
2009-11-14 11:19                     ` Richard Sandiford
2009-11-15 16:50                       ` Paolo Bonzini
2009-11-15 21:36                         ` Richard Sandiford
2009-11-28 10:53                           ` Richard Sandiford
2009-12-01 13:05                             ` Michael Matz
2009-12-02 22:24                               ` Richard Sandiford
2009-12-03 12:57                                 ` Michael Matz
2009-11-17 18:02                 ` Mark Mitchell
2009-10-31 19:23         ` Michael Matz [this message]
2009-11-01 10:13           ` Richard Sandiford

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=Pine.LNX.4.64.0910312002130.15566@wotan.suse.de \
    --to=matz@suse.de \
    --cc=bonzini@gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rdsandiford@googlemail.com \
    --cc=richard.guenther@gmail.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).