Re: [fpc-devel] x86-64: MOVZX peephole optimisations

2019-03-08 Thread J. Gareth Moreton
And apologies for my horrendous grammar in that last e-mail!  What I meant to say is that an option could be that x86-64 can favour MOVZX, since the oldest processors are guaranteed to have been first released no earlier than the early 2000s, while i386 and i8086 can favour MOV + AND, unless more

Re: [fpc-devel] x86-64: MOVZX peephole optimisations

2019-03-08 Thread J. Gareth Moreton
In that case, I would argue that it should optimise for more modern processors - that is, favour MOVZX, especially as the first few Pentium processors were released in the 90s.  If backwards-compatibility is more of a concern, well, if compiling for x86-64, when it's certain that the processor was

Re: [fpc-devel] x86-64: MOVZX peephole optimisations

2019-03-08 Thread Marģers . via fpc-devel
> 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

[fpc-devel] x86-64: MOVZX peephole optimisations

2019-03-07 Thread J. Gareth Moreton
Hi everyone, 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 moder