[fpc-devel] Producing assembly with less branches?

Florian Klämpfl florian at freepascal.org
Mon Jul 20 20:03:34 CEST 2020


Am 19.07.20 um 23:37 schrieb Stefan Glienke:
> Still kinda disappointing compared to what it could be - while this is 
> some simple code a modern compiler should try to eliminate conditional 
> jumps even with the incredibly powerful branch predictors nowadays.
> 
> clang and gcc emit this - I would guess they detect quite some common 
> patterns like this.

The price for this are huge compilation times. Having a design to able 
to detect such patterns and actually detecting them, simply takes time.

FPC compiling itself with the LLVM backend is approx. 10 times slower 
than FPC with it's native backend. On average code however, the code 
generated by the LLVM backend is only 10 % to 20 % faster.


More information about the fpc-devel mailing list