[fpc-devel] x86_64.inc CompareByte
J. Gareth Moreton
gareth at moreton-family.com
Sun Oct 1 01:28:58 CEST 2017
Oops, I just realised now that that byte sequence is your workaround, not actually already present in the
code! My bad, but yes, that is the correct byte sequence (although it's worth putting a comment in to
actually state what they are).
If the bug is known to still be present in GAS, then it might be a necessity - otherwise is it possible to
flag it up to get it fixed in GAS rather than having to do the dangerous task of encoding direct machine
code to get around it?
Gareth
On Sun 01/10/17 00:00 , "J. Gareth Moreton" gareth at moreton-family.com sent:
> 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.be
> th 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.fr
> eepascal.org
> > /cgi-bin/mailman/listinfo/fpc-devel
>
> >
>
>
>
> _______________________________________________
>
> fpc-devel maillist - fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>
>
>
>
More information about the fpc-devel
mailing list