This is the mail archive of the gcc@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: x86 optimization and rtx_cost question


On Fri, Jan 11, 2002 at 11:03:52AM -0600, Tom Crispin wrote:
> 	#define COSTS_N_INSNS(N) ((N) * 4)
> (why, BTW?  it can't possibly go back to 8080 when "fast" took 4 clocks,
> or??)

No, it's just a scaled value.  Otherwise you can't express stuff
like "Yes, both shift and add take one cycle, but we have two 
adders and one shifter, so prefer that".

> How can we decide whether to issue ...
> 
> 	movl	var_b, %edx
> 	addl	%edx, %eax
> 
> ... or ...
> 
> 	addl	var_b, %eax

Assuming var_b isn't used elsewhere, we should prefer the later form
until register allocation.  There are peepholes to split this into 
the two insn form based not on cost, but on whether we expect the 
two insn form to schedule better.


r~


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