[fpc-devel] Producing assembly with less branches?

J. Gareth Moreton gareth at moreton-family.com
Tue Jul 21 10:05:30 CEST 2020


It might still be possible to detect some patterns cheaply - I'l see 
what I can come up with.

Also, any successful reduction in the number of passes in the peephole 
optimizer will result in a speed-up that may offset any expensive checks 
(and the most expensive ones can be reserved for -O3 and -O4).

Gareth aka. Kit

On 20/07/2020 19:03, Florian Klämpfl wrote:
> 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.
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>


More information about the fpc-devel mailing list