x86 optimization and rtx_cost question
Richard Henderson
rth@redhat.com
Fri Jan 11 10:43:00 GMT 2002
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~
More information about the Gcc
mailing list