[fpc-devel] x86-64: MOVZX peephole optimisations
J. Gareth Moreton
gareth at moreton-family.com
Fri Mar 8 03:39:58 CET 2019
I'm a tad confused in regards to the best course of action regarding
MOVZX. Many of the peephole optimisations seek to change them to MOV
followed by AND (e.g. "movzbl (mem), %eax" to "mov (mem), %al; and $0xff,
%eax"). Does MOVZX have a well-documented performance penalty in modern
processors that favours the MOV/AND combination? It seems odd because the
combination implies a pipeline stall, which becomes more pronounced if the
MOV instruction is reading from memory.
The other issue is that there are some nasty traps in the i386/x86-64
peephole optimisation code because, if you're not careful with conditions,
it seems that you can get situations where the peephole optimizer enters an
infinite loop as it converts MOVZX to MOV/AND and back again.
I bring this up now because it's central to issue #35187.
Gareth aka. Kit
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-devel