[fpc-devel] LEA instruction speed

J. Gareth Moreton gareth at moreton-family.com
Thu Oct 12 20:02:09 CEST 2023


So an update.

I've added Spring.Benchmark to "tests/bench/spring" on my local branch, 
along with its readme and licence file.  It seems to work quite well 
even if it feels a bit like overkill for this small a benchmark.  Still, 
I've attached the version with Stefan's translated Google Benchmark unit 
to see what people think.  A couple of things to note:

  * Time metrics are now in thousands of nanoseconds because the 1,000
    repetitions of the internal loop (used to drown out the overhead of
    the function call) are no longer divided out.
  * Requires the fcl-base, rtl-objpas and regexpr packages.

I also made a mistake with the compiler flags.  I had added 
CPUX86_HINT_FAST_3COMP_ADDR_16 to indicate that a LEA instruction with 
16-bit operands is fast, since the timing is often different to the 
32/64-bit versions.  However, under i386 and x86_64, the assembler 
doesn't accept 16-bit operands!  I have therefore removed it for i386 
and x86_64, although I left it in for i8086 (even though it probably 
won't be used) because the Pentium 4 has a slow 16-bit LEA instruction.

However, the proposed COREX CPU option now has the exact same flags as 
ZEN3.  Should it be removed, or kept for clarity and future expansion?

Kit

P.S. Sorry for the size of the ZIP.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20231012/a36c0152/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: blea3.zip
Type: application/x-zip-compressed
Size: 48867 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20231012/a36c0152/attachment-0001.bin>


More information about the fpc-devel mailing list