This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: x86 optimization and rtx_cost question
- From: Richard Henderson <rth at redhat dot com>
- To: Tom Crispin <crispin at centtech dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 11 Jan 2002 10:21:48 -0800
- Subject: Re: x86 optimization and rtx_cost question
- References: <3C3F1AF8.D340E94B@centtech.com>
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~