[fpc-devel] Optimization stops near inline asm

Florian Klämpfl florian at freepascal.org
Mon Oct 3 10:14:59 CEST 2011


Am 03.10.2011 08:27, schrieb Alexander Klenin:
> the following code:
> {$mode objfpc}
> var
>    a: Integer;
> begin
>    a := a + 1;
>    asm nop end;
> end.
>
> generates (under -O2):
>
> 	movl	U_P$PROGRAM_A,%eax
> 	incl	%eax
> 	movl	%eax,U_P$PROGRAM_A
> 	nop
>
> instead of a single "incl".
> removing either "asm" statement OR $mode directive
> reinstates the optimization (although in the latter case with "incw",
> of course).
>
> This obviously never matters in practice, but may be a symptom of some more
> serious problem. Should I file a bug report?
>

FPC doesn't do any optimization in procedures containing inline assembler.



More information about the fpc-devel mailing list