[fpc-devel] Request to remove "movzwl %ax, %eax" -> "andl $0xffff, %ax" optimisations

J. Gareth Moreton gareth at moreton-family.com
Wed Nov 27 18:08:34 CET 2019


Hi everyone,

Specifically to Florian, Jonas and Pierre, I would like to remove the 
"movz-> and" family of optimisations from the x86 peephole optimiser 
because the zero-extension commands no longer have the performance 
penalty that they had back in the 90s.  Both instructions have a 
read/write dependency, but movzx uses fewer bytes.

On a side-note, I'm exploring OptPass1Movx a bit more closely and found 
that you can't set Result to True on some of the optimisations (to 
indicate a change and to re-run Pass 1 under -O3) because they cause an 
infinite loop if you do (I've been researching ways to cut down on 
passes and speed up the peephole optimiser).  Additionally, there's also 
a problem that the optimisations in question sometimes end up 'fighting' 
with an optimisation in OptPass1MOV that does the opposite.  Either way 
it makes this part of the codebase somewhat fragile as well as wasting 
compilation time.

Gareth aka. Kit



More information about the fpc-devel mailing list