[fpc-devel] Optimizer Overhaul Take 2... Jump Optimizations
J. Gareth Moreton
gareth at moreton-family.com
Thu Oct 31 06:31:22 CET 2019
A partial example of where "condition_in" shows its power (compiled code
from fpc\packages\fcl-base\src\advancedipc.pp)
BEFORE:
...
jb .Lj178
subl $17,%eax
cmpl $26,%eax
jb .Lj178
cmpl $30,%eax
stc
je .Lj178
subl $32,%eax
cmpl $26,%eax
.Lj178:
jc .Lj180 (Appears later in the code)
...
AFTER:
...
jb .Lj180 <-- Label changed
subl $17,%eax
cmpl $26,%eax
jb .Lj180 <-- Label changed
cmpl $30,%eax
stc
je .Lj178
subl $32,%eax
cmpl $26,%eax
.Lj178:
jc .Lj180 (Appears later in the code)
...
In this case, 'condition_in' detects that C_C is a subset of C_B
(they're actually equivalent in this case... both branch if the Carry
Flag is set). This particular optimisation means that the code only has
to branch once if the JB conditions are met, rather than twice.
Gareth aka. Kit
--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
More information about the fpc-devel
mailing list