This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] fix address_cost for x86

On 7/5/07, Zdenek Dvorak <> wrote:

> >     * config/i386/i386.c (ix86_address_cost): Do not consider more
> >     complex
> >     addressing modes cheaper.
> Does this patch also fix PR 24669 and two PRs that it blocks?

it fixes PR 24669, but not PRs 18219 and 26726.  The problem is
that both using and not using the offset has the same cost with the
change, and ivopts just select between them arbitrarily; which
happens to be the offsetted mode for these two PRs.  Anyway, this should
be easy to fix in ivopts.

It would be nice if this issue got fixed somehow. All costs being equal, IMO ivopts should prefer less complex addressing mode, as it implies smaller instructions. This is especially important for -Os, but I guess that it won't hurt even in -O2 case. Also, introducing some determinism into mode selection mechanism could greatly reduce number of possible heisenbugs.

> BTW: Some time ago, I have played with address_cost on x86 (trying to
> fix PR 24669), but by changing the costs there, access to symbols
> regressed badly - gcc didn't produce [ref + offset] addressing, but
> ony reg = ref + offset; [reg] indirect sequences. Have you checked
> this issue with your patch?

I do not see this happen (i.e., [ref + offset] addresses seem to be
produced as expected).  Do you have some concrete example that used
to cause problems?

Testing the patch, as attached to PR24669, I noticed a small runtime regression in Povray due to indirect addressing. However, your patch introduces different cost metric, and if it still loads symbols using complex x86 addressing modes where appropriate, it is OK for mainline. But please also check it on register limited 32bit i386 target.

Thanks for looking into this,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]