Re: optimising recursive functions

2007-10-27 Thread Zdenek Dvorak
Hi, > > > So I am guessing the Felix version is lucky there are > > > no gratuitous temporaries to be saved when this happens, > > > and the C code is unlucky and there are. > > > > > > Maybe someone who knows how the optimiser works can comment? > > > > One problem with departing from the ABI eve

Re: optimising recursive functions

2007-10-27 Thread skaller
On Sat, 2007-10-27 at 12:54 +0200, Richard Guenther wrote: > On 10/27/07, Robert Dewar <[EMAIL PROTECTED]> wrote: > > skaller wrote: > > > > > So I am guessing the Felix version is lucky there are > > > no gratuitous temporaries to be saved when this happens, > > > and the C code is unlucky and th

Re: optimising recursive functions

2007-10-27 Thread Eric Botcazou
> If you make the function static then gcc can chose ABI-incompatible > calling conventions. Right, and the gain can be significant on x86. -- Eric Botcazou

Re: optimising recursive functions

2007-10-27 Thread Richard Guenther
On 10/27/07, Robert Dewar <[EMAIL PROTECTED]> wrote: > skaller wrote: > > > So I am guessing the Felix version is lucky there are > > no gratuitous temporaries to be saved when this happens, > > and the C code is unlucky and there are. > > > > Maybe someone who knows how the optimiser works can com

Re: optimising recursive functions

2007-10-27 Thread Robert Dewar
skaller wrote: On Fri, 2007-10-26 at 20:26 -0400, Robert Dewar wrote: skaller wrote: So I am guessing the Felix version is lucky there are no gratuitous temporaries to be saved when this happens, and the C code is unlucky and there are. Maybe someone who knows how the optimiser works can comm

Re: optimising recursive functions

2007-10-26 Thread skaller
On Fri, 2007-10-26 at 20:26 -0400, Robert Dewar wrote: > skaller wrote: > > > So I am guessing the Felix version is lucky there are > > no gratuitous temporaries to be saved when this happens, > > and the C code is unlucky and there are. > > > > Maybe someone who knows how the optimiser works ca

Re: optimising recursive functions

2007-10-26 Thread Robert Dewar
skaller wrote: So I am guessing the Felix version is lucky there are no gratuitous temporaries to be saved when this happens, and the C code is unlucky and there are. Maybe someone who knows how the optimiser works can comment? One problem with departing from the ABI even on a local level lik

optimising recursive functions

2007-10-26 Thread skaller
I have occasionally examined asm generated by gcc on my amd64, and it appears gcc is not optimising recursive functions very well, though I'm not sure. I find in code like: int f(int x) { ... f(y) ... } that gcc generates an extern ABI compliant function f, which is recursively c