[fpc-devel] Bitset assembler

Jy V jyv110 at gmail.com
Sat Sep 10 12:55:39 CEST 2016

On Fri, Sep 9, 2016 at 11:00 AM, Thaddy de Koning <thaddy at thaddy.co.uk>

> With the proper optimizations it will probably hard to improve on.
> Compile the code with -O4 and -s. That generates the assembler output in a
> *.s file.
> The compiler is rather good at bitmaniputations.

I am not sure the FreePascal compiler is able to convert the code of the
procedure BitsetSet(var Bits; Index: UInt32);
  PUInt64Array(@Bits)^[Index shr 6] := PUInt64Array(@Bits)^[Index shr 6] or
(Int64(1) shl (Index and 63));

into a single instruction:

 bts [eax], edx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20160910/1517c3e3/attachment.html>

More information about the fpc-devel mailing list