[fpc-devel] x86_64.inc CompareByte

J. Gareth Moreton gareth at moreton-family.com
Sun Oct 1 01:00:32 CEST 2017


Hi Markus,

Nice to see there's more than one person working to improve compiled code on x86-64!

I can answer one question... the byte sequence 0F B6 01 is the direct machine code representation of movzbl 
(%rcx),%eax - this might be due to a bug with the assembler or movzbl not being recognised (I had to do the 
same thing with xgetbv once).

Gareth Moreton


On Sat 30/09/17 23:24 , Markus Beth markus.beth at zkrd.de sent:
> It did some changes to CompareByte in rtl/x86_64/x86_64.inc to reduce 
> the code size and make it run faster (see attached path). I was 
> successful with the code size deduction (47 bytes vs. 62 bytes) and also 
> with the speed (according to a micro benchmark [1] run on an Ivy Bridge 
> desktop).
> 
> To achieve this I used movzbl twice. But then I came across the comment 
> in FillChar (also in rtl/x86_64/x86_64.inc) about movzbl breaking 
> targets using external GAS (Mantis #19188). As this Mantis issue is 
> dated back in 2011 my question is: Is this still valid? And what would 
> be the preferred way to overcome this issue?
> {$ifdef oldbinutils}
> .byte 0x0F,0xb6,0x01
> {$else}
> movzbl (%rcx),%eax
> {$endif}
> 
> Markus
> 
> [1] the benchmark compares a 10 MB memory block with itself 10000 times
> 
> _______________________________________________
> fpc-devel maillist - fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel [1]
> 
> 
> 
> Links:
> ------
> [1]
> http://secureweb.fast.net.uk/parse.php?redirect=http://lists.freepascal.org
> /cgi-bin/mailman/listinfo/fpc-devel
> 




More information about the fpc-devel mailing list