public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* ARCH_rtx_costs
@ 2004-10-07 13:04 Shinpei Kato
  2004-10-07 19:17 ` ARCH_rtx_costs Eric Christopher
  0 siblings, 1 reply; 5+ messages in thread
From: Shinpei Kato @ 2004-10-07 13:04 UTC (permalink / raw)
  To: gcc

Hi there,

When porting gcc to own arch, we need to prepare $ARCH_rtx_costs, like mips_rtx_costs.
I don't know how to calculate these costs.
How could I achieve it? 
Which reference do I need to refer to? I think there are few helps about it in GCC internals.
I need your help.

Regards,
Shinpei Kato

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ARCH_rtx_costs
  2004-10-07 13:04 ARCH_rtx_costs Shinpei Kato
@ 2004-10-07 19:17 ` Eric Christopher
  2004-10-08  8:01   ` ARCH_rtx_costs Shinpei Kato
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Christopher @ 2004-10-07 19:17 UTC (permalink / raw)
  To: Shinpei Kato; +Cc: gcc

On Thu, 2004-10-07 at 04:46, Shinpei Kato wrote:
> Hi there,
> 
> When porting gcc to own arch, we need to prepare $ARCH_rtx_costs, like mips_rtx_costs.
> I don't know how to calculate these costs.
> How could I achieve it? 
> Which reference do I need to refer to? I think there are few helps about it in GCC internals.
> I need your help.

http://gcc.gnu.org/onlinedocs/gccint/Costs.html#Costs

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).

Good luck.

-eric

-- 
Eric Christopher <echristo@redhat.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ARCH_rtx_costs
  2004-10-07 19:17 ` ARCH_rtx_costs Eric Christopher
@ 2004-10-08  8:01   ` Shinpei Kato
  2004-10-08  8:18     ` ARCH_rtx_costs Steven Bosscher
  0 siblings, 1 reply; 5+ messages in thread
From: Shinpei Kato @ 2004-10-08  8:01 UTC (permalink / raw)
  To: gcc

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.
If I don't know about cycle cost, I need to ask people who develop an
architecture.
Is my understanding correct?

Regards,
Shinpei Kato

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ARCH_rtx_costs
  2004-10-08  8:01   ` ARCH_rtx_costs Shinpei Kato
@ 2004-10-08  8:18     ` Steven Bosscher
  2004-10-08 11:47       ` ARCH_rtx_costs Shinpei Kato
  0 siblings, 1 reply; 5+ messages in thread
From: Steven Bosscher @ 2004-10-08  8:18 UTC (permalink / raw)
  To: Shinpei Kato, gcc

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ARCH_rtx_costs
  2004-10-08  8:18     ` ARCH_rtx_costs Steven Bosscher
@ 2004-10-08 11:47       ` Shinpei Kato
  0 siblings, 0 replies; 5+ messages in thread
From: Shinpei Kato @ 2004-10-08 11:47 UTC (permalink / raw)
  To: Steven Bosscher; +Cc: gcc

> /* 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.

I see, I should have looked at the source before, sorry.
Thank you for your help.

- Shinpei

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-10-08  8:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-07 13:04 ARCH_rtx_costs Shinpei Kato
2004-10-07 19:17 ` ARCH_rtx_costs Eric Christopher
2004-10-08  8:01   ` ARCH_rtx_costs Shinpei Kato
2004-10-08  8:18     ` ARCH_rtx_costs Steven Bosscher
2004-10-08 11:47       ` ARCH_rtx_costs Shinpei Kato

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).