Re: [fpc-devel] Optimization stops near inline asm

2011-10-03 Thread Florian Klämpfl
Am 03.10.2011 10:24, schrieb Jonas Maebe: On 03 Oct 2011, at 10:14, Florian Klämpfl wrote: FPC doesn't do any optimization in procedures containing inline assembler. It does. Oops, I thought you changed this a while ago :) ___ fpc-devel maillist

Re: [fpc-devel] Optimization stops near inline asm

2011-10-03 Thread Hans-Peter Diettrich
Jonas Maebe schrieb: It does. But also assumes that all registers are used in assembler blocks, unless the programmer specifies otherwise. But a:=a+1; does not imply any register usage, and the variable is a global one? DoDi ___ fpc-devel maillis

Re: [fpc-devel] Optimization stops near inline asm

2011-10-03 Thread Alexander Klenin
2011/10/3 Jonas Maebe : >  asm nop end []; > > then the statement will optimized. Otherwise the compiler assumes that the > contents of eax may still be used inside the assembler block and hence > cannot remove its use. > > The fact that the optimization is performed in case the used register is ax

Re: [fpc-devel] Optimization stops near inline asm

2011-10-03 Thread Jonas Maebe
On 03 Oct 2011, at 10:14, Florian Klämpfl wrote: FPC doesn't do any optimization in procedures containing inline assembler. It does. But also assumes that all registers are used in assembler blocks, unless the programmer specifies otherwise. If you change the assembler block into asm

Re: [fpc-devel] Optimization stops near inline asm

2011-10-03 Thread Florian Klämpfl
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): movlU_P$PROGRAM_A,%eax incl%eax movl%eax,U_P$PROGRAM_A nop instead of a single "incl

[fpc-devel] Optimization stops near inline asm

2011-10-02 Thread Alexander Klenin
the following code: {$mode objfpc} var a: Integer; begin a := a + 1; asm nop end; end. generates (under -O2): movlU_P$PROGRAM_A,%eax incl%eax movl%eax,U_P$PROGRAM_A nop instead of a single "incl". removing either "asm" statement OR $mode directiv