[fpc-devel] Tail recursion optimization

Daniël Mantione daniel.mantione at freepascal.org
Tue Oct 10 13:54:07 CEST 2006



Op Tue, 10 Oct 2006, schreef Florian Klaempfl:

> > There's a FlagsUsed field in the ttaiprop record which is set to true if
> > the flags result of that instruction is used.
> 
> I guess it could be used to change to code above to
> leal 1(%esi),%eax
> ?
> 
> Or is this slower on some CPUs?

In the worst case, as fast. Some cpu's use an extra clock cycle through 
the ALU to calculate the effective address (Pentium 1 if I recall well).

RISC86 cpus (k6..opteron) use their load/store unit to calculate this, 
so it might speed up because one extra ALU is free, or slow down because 
the load/store unit is occupied by another instruction.

Daniël


More information about the fpc-devel mailing list