[fpc-devel] Progress on reviewing x86_64 optimizer overhaul and node semantic pass

J. Gareth Moreton gareth at moreton-family.com
Fri Oct 18 18:07:25 CEST 2019

Hi everyone,

How is everyone doing?  Sorry for my silence - been a bit tied up with 
things in life.  Anyway, that aside, has there been any further progress 
on reviewing the x86_64 optimizer overhaul over at 
https://bugs.freepascal.org/view.php?id=34628? I ask because I've 
sort-of blocked myself in any further improvements to the peephole 

The other one that requires further review is the node semantic pass 
work over at https://bugs.freepascal.org/view.php?id=35857 - I figure 
there could be some improvements I could make, especially in regards to 
efficiency, but it would be easier to do with the applied patch rather 
than from scratch.  Also, some future optimisations might benefit from 
further analysis of node structures.  For example, if the Free Pascal 
Compiler is to build a project supporting AVX and FMA, it would be 
easier to convert vectored addition and multiplication routines into a 
single fused multiply-add instruction at the node level instead of in 
the peephole optimizer - true, it would still be possible to do it at 
this stage (and it might still have to in order to catch every possible 
case), but there's a risk that the vector is broken up into individual 
scalars before it reaches the peephole optimizer. In particular, I'm 
looking at units like "uComplex" that would greatly benefit from this, 
since the 'complex' data type is generally stored as two sequential 
double-precision floating-point values, this exactly filling a single 
XMM register where operations like addition and subtraction are 
component-wise (also, the operations as defined in the unit are inlined, 
so theoretically can collapse into a single (V)ADDPD instruction).

I'm still working on 'pure' functions on the side, so this is not a lost 

Gareth aka. Kit

This email has been checked for viruses by Avast antivirus software.

More information about the fpc-devel mailing list