* ix86_address_cost
@ 2004-11-28 22:29 Zdenek Dvorak
2004-11-28 22:37 ` ix86_address_cost Jan Hubicka
0 siblings, 1 reply; 4+ messages in thread
From: Zdenek Dvorak @ 2004-11-28 22:29 UTC (permalink / raw)
To: gcc; +Cc: rth, jh
Hello,
what is the purpose of the following code in ix86_address_cost:
/* More complex memory references are better. */
if (parts.disp && parts.disp != const0_rtx)
cost--;
?
It in effect claims that [reg] is more expensive than [reg - 4].
This leads ivopts to generate pretty weird code; for example on code
of type
for (i = 0; i < n; i++)
{
a[i] = something;
b[i] = something;
c[i] = something;
}
it decides that it may be better to use an induction variable with
initial value 1:
for (ivtmp = 1; ivtmp - 1 < n; ivtmp++)
{
a[ivtmp - 1] = something;
b[ivtmp - 1] = something;
c[ivtmp - 1] = something;
}
Since obviously we gain 1 in cost for every use in address, and lose
relatively little on having to express ivtmp - 1.
Zdenek
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ix86_address_cost
2004-11-28 22:29 ix86_address_cost Zdenek Dvorak
@ 2004-11-28 22:37 ` Jan Hubicka
2004-11-28 23:14 ` ix86_address_cost Zdenek Dvorak
0 siblings, 1 reply; 4+ messages in thread
From: Jan Hubicka @ 2004-11-28 22:37 UTC (permalink / raw)
To: Zdenek Dvorak; +Cc: gcc, rth, jh
> Hello,
>
> what is the purpose of the following code in ix86_address_cost:
>
> /* More complex memory references are better. */
> if (parts.disp && parts.disp != const0_rtx)
> cost--;
> ?
>
> It in effect claims that [reg] is more expensive than [reg - 4].
> This leads ivopts to generate pretty weird code; for example on code
> of type
The main idea behind this hack is to force CSE to use complex addressing
modes (ie if it uses reg-4 instead of reg2, one might hope for that
"reg2=reg-4" statement will get dead and elliminated completely).
This would ineed be interesting thing to re-benchmark so we see if it
still does any good.
Honza
>
> for (i = 0; i < n; i++)
> {
> a[i] = something;
> b[i] = something;
> c[i] = something;
> }
>
> it decides that it may be better to use an induction variable with
> initial value 1:
>
> for (ivtmp = 1; ivtmp - 1 < n; ivtmp++)
> {
> a[ivtmp - 1] = something;
> b[ivtmp - 1] = something;
> c[ivtmp - 1] = something;
> }
>
> Since obviously we gain 1 in cost for every use in address, and lose
> relatively little on having to express ivtmp - 1.
>
> Zdenek
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ix86_address_cost
2004-11-28 22:37 ` ix86_address_cost Jan Hubicka
@ 2004-11-28 23:14 ` Zdenek Dvorak
2004-11-29 1:24 ` ix86_address_cost Jan Hubicka
0 siblings, 1 reply; 4+ messages in thread
From: Zdenek Dvorak @ 2004-11-28 23:14 UTC (permalink / raw)
To: Jan Hubicka; +Cc: gcc, rth
Hello,
> > what is the purpose of the following code in ix86_address_cost:
> >
> > /* More complex memory references are better. */
> > if (parts.disp && parts.disp != const0_rtx)
> > cost--;
> > ?
> >
> > It in effect claims that [reg] is more expensive than [reg - 4].
> > This leads ivopts to generate pretty weird code; for example on code
> > of type
>
> The main idea behind this hack is to force CSE to use complex addressing
> modes (ie if it uses reg-4 instead of reg2, one might hope for that
> "reg2=reg-4" statement will get dead and elliminated completely).
>
> This would ineed be interesting thing to re-benchmark so we see if it
> still does any good.
this seems like a quite terrible way how to persuade CSE to do this. Would
not it be better to add this "complicated address" bonus directly in
CSE, and let address_cost do just what it is supposed to -- compute cost of
the address?
Zdenek
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ix86_address_cost
2004-11-28 23:14 ` ix86_address_cost Zdenek Dvorak
@ 2004-11-29 1:24 ` Jan Hubicka
0 siblings, 0 replies; 4+ messages in thread
From: Jan Hubicka @ 2004-11-29 1:24 UTC (permalink / raw)
To: Zdenek Dvorak; +Cc: Jan Hubicka, gcc, rth
> Hello,
>
> > > what is the purpose of the following code in ix86_address_cost:
> > >
> > > /* More complex memory references are better. */
> > > if (parts.disp && parts.disp != const0_rtx)
> > > cost--;
> > > ?
> > >
> > > It in effect claims that [reg] is more expensive than [reg - 4].
> > > This leads ivopts to generate pretty weird code; for example on code
> > > of type
> >
> > The main idea behind this hack is to force CSE to use complex addressing
> > modes (ie if it uses reg-4 instead of reg2, one might hope for that
> > "reg2=reg-4" statement will get dead and elliminated completely).
> >
> > This would ineed be interesting thing to re-benchmark so we see if it
> > still does any good.
>
> this seems like a quite terrible way how to persuade CSE to do this. Would
> not it be better to add this "complicated address" bonus directly in
> CSE, and let address_cost do just what it is supposed to -- compute cost of
> the address?
I would fully agree here if it matters :))
Honza
>
> Zdenek
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-11-28 23:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-28 22:29 ix86_address_cost Zdenek Dvorak
2004-11-28 22:37 ` ix86_address_cost Jan Hubicka
2004-11-28 23:14 ` ix86_address_cost Zdenek Dvorak
2004-11-29 1:24 ` ix86_address_cost Jan Hubicka
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).