This is the mail archive of the gcc-patches@gcc.gnu.org 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 Fri, Jul 06, 2007 at 09:29:48PM +0200, Zdenek Dvorak wrote:
> Hello,

> >    Why should ivopts have such target specific knowledge? Why can't you fix
> > ix86_address_cost() to return a smaller cost for the most preferred form of
> > the address?
> 
> I definitely prefer address_cost to give correct information; i.e., if
> two addressing modes have the same cost (which is the case on x86),
> address_cost should say so.

   If the cost is really the same, why is it a problem that ivopts chooses
one form over the other? Note that if you want to break a tie by choosing
the smallest form, you can simply ask the back end for the size of the two
forms. Just temporarily set optimize_size to 1.
 
> In particular, if we started to pretend that non-indexed addressing
> modes are cheaper, then we would fail to combine
> 
> a = b + cst;
> use ([a]);
> 
> to
> 
> use([b + cst]);

   I was assuming the cost of the extra add instruction would be taken
into account. If it isn't, we can't expect to get something like this right.

-- 
Rask Ingemann Lambertsen


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