[fpc-pascal] Registers in loops

patspiper patspiper at gmail.com
Fri Dec 14 09:26:39 CET 2012


On 13/12/12 21:51, denisgolovan wrote:
> Hi all
>
> Recently I discovered that fpc refuses to use registers in my loops even with optimization turned on (-O1,-O3 used).
With the asm code commented out and without any optimization, the 
registers are used.

.Ll12:
# [47] for i:=1 to 100000000 do
     movl    $1,%ebx
     decl    %ebx
     .balign 4,0x90
.Lj80:
     incl    %ebx
.Ll13:
# [48] Inc(i2);
     incl    %eax
.Ll14:
     cmpl    $100000000,%ebx
     jb    .Lj80
...
.Ll18:
# [53] i:=1;
     movl    $1,%ebx
     .balign 4,0x90
.Lj111:
.Ll19:
# [55] Inc(i);
     incl    %ebx
.Ll20:
# [56] until i>100000000;
     cmpl    $100000000,%ebx
     jna    .Lj111
...
.Ll24:
# [61] i:=1;
     movl    $1,%ebx
.Ll25:
# [62] while i<100000000 do
     jmp    .Lj145
     .balign 4,0x90
.Lj144:
.Ll26:
# [63] Inc(i);
     incl    %ebx
.Lj145:
.Ll27:
     cmpl    $100000000,%ebx
     jb    .Lj144

Stephano



More information about the fpc-pascal mailing list