r18252 - x*x -> sqr(x) optimization (Was: Re: [fpc-devel] ARMnative compilation (Toshiba AC100))
Ludo Brands
ludo.brands at free.fr
Fri Sep 23 14:18:08 CEST 2011
> function fpc_sqr_real(d : ValReal) :
> ValReal;compilerproc;{$ifdef
> MATHINLINE}inline;{$endif}
> begin
> result := d*d;
> end;
>
> So yes, this clearly puts the compiler into an endless loop. I'm not
> sure what would be a clean fix for this (other than completely
> disabling the transformation; does it improve the generated
> code that
> much beyond what CSE can achieve?)
-O2 doesn't optimize the follow into a new call to fpc_sqr_real (svn 18901):
function fpc_sqr_real(d : ValReal) : ValReal;compilerproc;inline;
Begin
fpc_sqr_real:=d;
fpc_sqr_real:=fpc_sqr_real*d;
End;
Ludo
More information about the fpc-devel
mailing list