ARCH_rtx_costs

Steven Bosscher stevenb@suse.de
Fri Oct 8 08:18:00 GMT 2004


On Friday 08 October 2004 03:20, Shinpei Kato wrote:
> Hi, Eric. Thanks for reply.
>
> > http://gcc.gnu.org/onlinedocs/gccint/Costs.html#Costs
>
> Yes I refer to it.
>
> > Has most of the cost information you need, looking at a similar existing
> > port could help.  What you want to remember in particular is that it's a
> > set of relative costs. For example, if your "fast" instruction is an
> > add, e.g. add $2, $3, $4, and takes one cycle and a multiply takes 12
> > cycles then you'd want to have a MULT cost COST_N_INSNS (12).
>
> So COST_N_INSNS doesn't mean real cycles but relative cycles, does it?
> That is, COST_N_INSNS (1) doesn't mean one cycle.

It's COSTS_N_INSNS, note the extra S.  From rtl.h: (you can look at
the sources too, they're there for a reason ;-)

/* Return the right cost to give to an operation
   to make the cost of the corresponding register-to-register instruction
   N times that of a fast register-to-register instruction.  */
#define COSTS_N_INSNS(N) ((N) * 4)

so COSTS_N_INSNS(1) is the cost of a reg-reg move instruction, and
COSTS_N_INSNS(X) is the cost of X is relative to that.


> If I don't know about cycle cost, I need to ask people who develop an
> architecture.

Yes.

Gr.
Steven




More information about the Gcc mailing list