[fpc-devel] x86-64 compilation of while loops
J. Gareth Moreton
gareth at moreton-family.com
Tue May 29 21:48:49 CEST 2018
That seems fair. Thank you for your
answer. I'm still learning about the
nuances of branch prediction and the like.
On Tue 29/05/18 21:27 , Florian Klämpfl
florian at freepascal.org sent:
> Am 28.05.2018 um 01:55 schrieb J. Gareth
Moreton:
>
> >
>
> > In this case, the ".balign" hint adds
> 2 bytes to pad the loop. However, my
question is this... why
> > does it immediately jump to the end of
the loop
> to check the condition (which is very
likely to be
> > true on the first iteration), only to
jump to
> the beginning again?
>
>
> Several reasons:
>
> - it is not that easy to find a
heuristics when the condition should be
> checked twice
> - two conditional jumps waste an extra
branch prediction table entry
>
> - bigger code, higher cache usage
>
>
>
> Weigthing these reasons against the
little overhead of an extra
> unconditional jump, we decided to
> use the currently used code generation
strategy.
>
>
__________________________________________
_____
>
> fpc-devel maillist - fpc-
devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-
bin/mailman/listinfo/fpc-devel
>
>
>
>
More information about the fpc-devel
mailing list