<HTML>
<div><style> BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }</style>Hi everyone,</div><div><br>
</div><div>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.</div><div><br>
</div><div>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.</div><div><br>
</div><div>I bring this up now because it's central to issue #35187.</div><div><br>
</div><div>Gareth aka. Kit<br>
</div> </HTML>