This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: ix86_address_cost
- From: Jan Hubicka <jh at suse dot cz>
- To: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- Cc: gcc at gcc dot gnu dot org, rth at redhat dot com, jh at suse dot cz
- Date: Sun, 28 Nov 2004 23:27:47 +0100
- Subject: Re: ix86_address_cost
- References: <20041128220627.GA26602@atrey.karlin.mff.cuni.cz>
> 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