On 2023-10-09 20:51, J. Gareth Moreton via fpc-devel wrote:


Hi Kit,

I updated the "blea" test in the merge request so it now displays the
processor brand name on x86_64; however, it is not fetched under i386
because CPUID was not introduced until later 486 processors.  I've
attached it to this e-mail if anyone wants to take a look to ensure I
haven't broken something.

I don't know what's broken, but the results vary so much on a fast machine that they are unusable for any measurement from my point of view (standard 3.2.2 compiler, compiled with -O4 and running under MS Windows this time). Sometimes the ADD version shows 0.0 ns/call, sometimes the LEA version shows 0.0 ns/call (32-bits) or 0.1 ns/call (64-bits). See the attached results (the CPU is only displayed for the 64-bit compilation, but it's obviously the same CPU).

Tomas



On 09/10/2023 18:01, J. Gareth Moreton via fpc-devel wrote:
Thank you very much!  That processor is built on the Excavator architecture and lines up with the flag I put in the merge request (i.e. it has the "fast LEA" hint).

I honestly didn't expect this much testing feedback, so thank you all!

Gareth aka. Kit

P.S. I'm tempted to extend the test slightly to actually name the CPU automatically.

On 09/10/2023 15:40, Jean SUZINEAU via fpc-devel wrote:
My results:
jean@First-Boss:~/temp$ cat /proc/cpuinfo | grep "model name"
model name    : AMD A6-7480 Radeon R5, 8 Compute Cores 2C+6G
jean@First-Boss:~/temp$ /usr/bin/fpc blea.pp
Free Pascal Compiler version 3.2.2 [2021/07/09] for x86_64
Copyright (c) 1993-2021 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling blea.pp
Linking blea
95 lines compiled, 0.2 sec
jean@First-Boss:~/temp$ ./blea
   Pascal control case: 5.1 ns/call
 Using LEA instruction: 0.5 ns/call
Using ADD instructions: 0.8 ns/call
jean@First-Boss:~/temp$

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
32-bit version, 10 runs in a row using a command shell for cycle, LEA before 
ADD (original version):

   Pascal control case: 0.9 ns/call
 Using LEA instruction: 0.0 ns/call
Using ADD instructions: 1.6 ns/call
   Pascal control case: 0.4 ns/call
 Using LEA instruction: 1.5 ns/call
Using ADD instructions: 0.0 ns/call
   Pascal control case: 0.1 ns/call
 Using LEA instruction: 1.6 ns/call
Using ADD instructions: 1.2 ns/call
   Pascal control case: 0.2 ns/call
 Using LEA instruction: 1.8 ns/call
Using ADD instructions: 0.0 ns/call
   Pascal control case: 0.2 ns/call
 Using LEA instruction: 1.0 ns/call
Using ADD instructions: 1.6 ns/call
   Pascal control case: 0.2 ns/call
 Using LEA instruction: 1.6 ns/call
Using ADD instructions: 0.0 ns/call
   Pascal control case: 0.2 ns/call
 Using LEA instruction: 1.8 ns/call
Using ADD instructions: 0.0 ns/call
   Pascal control case: 0.1 ns/call
 Using LEA instruction: 1.6 ns/call
Using ADD instructions: 0.8 ns/call
   Pascal control case: 1.1 ns/call
 Using LEA instruction: 0.1 ns/call
Using ADD instructions: 1.6 ns/call
   Pascal control case: 0.2 ns/call
 Using LEA instruction: 1.5 ns/call
Using ADD instructions: 0.0 ns/call


32-bit version, 10 runs in a row using a command shell for cycle, LEA before 
ADD (original version):

   Pascal control case: 0.9 ns/call
 Using LEA instruction: 0.0 ns/call
Using ADD instructions: 1.6 ns/call
   Pascal control case: 0.4 ns/call
 Using LEA instruction: 1.5 ns/call
Using ADD instructions: 0.0 ns/call
   Pascal control case: 0.1 ns/call
 Using LEA instruction: 1.6 ns/call
Using ADD instructions: 1.2 ns/call
   Pascal control case: 0.2 ns/call
 Using LEA instruction: 1.8 ns/call
Using ADD instructions: 0.0 ns/call
   Pascal control case: 0.2 ns/call
 Using LEA instruction: 1.0 ns/call
Using ADD instructions: 1.6 ns/call
   Pascal control case: 0.2 ns/call
 Using LEA instruction: 1.6 ns/call
Using ADD instructions: 0.0 ns/call
   Pascal control case: 0.2 ns/call
 Using LEA instruction: 1.8 ns/call
Using ADD instructions: 0.0 ns/call
   Pascal control case: 0.1 ns/call
 Using LEA instruction: 1.6 ns/call
Using ADD instructions: 0.8 ns/call
   Pascal control case: 1.1 ns/call
 Using LEA instruction: 0.1 ns/call
Using ADD instructions: 1.6 ns/call
   Pascal control case: 0.2 ns/call
 Using LEA instruction: 1.5 ns/call
Using ADD instructions: 0.0 ns/call


64-bit version, 10 runs in a row using a command shell for cycle, LEA before 
ADD (original version):

CPU = Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz
-----------------------------------------------
   Pascal control case: 0.6 ns/call
 Using LEA instruction: 1.7 ns/call
Using ADD instructions: 0.0 ns/call
CPU = Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz
-----------------------------------------------
   Pascal control case: 0.5 ns/call
 Using LEA instruction: 1.1 ns/call
Using ADD instructions: 1.7 ns/call
CPU = Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz
-----------------------------------------------
   Pascal control case: 1.2 ns/call
 Using LEA instruction: 0.3 ns/call
Using ADD instructions: 1.9 ns/call
CPU = Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz
-----------------------------------------------
   Pascal control case: 0.9 ns/call
 Using LEA instruction: 1.8 ns/call
Using ADD instructions: 0.0 ns/call
CPU = Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz
-----------------------------------------------
   Pascal control case: 0.3 ns/call
 Using LEA instruction: 1.4 ns/call
Using ADD instructions: 1.6 ns/call
CPU = Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz
-----------------------------------------------
   Pascal control case: 1.2 ns/call
 Using LEA instruction: 0.4 ns/call
Using ADD instructions: 1.6 ns/call
CPU = Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz
-----------------------------------------------
   Pascal control case: 0.2 ns/call
 Using LEA instruction: 2.0 ns/call
Using ADD instructions: 1.1 ns/call
CPU = Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz
-----------------------------------------------
   Pascal control case: 1.2 ns/call
 Using LEA instruction: 0.3 ns/call
Using ADD instructions: 1.6 ns/call
CPU = Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz
-----------------------------------------------
   Pascal control case: 1.2 ns/call
 Using LEA instruction: 0.3 ns/call
Using ADD instructions: 1.7 ns/call
CPU = Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz
-----------------------------------------------
   Pascal control case: 1.0 ns/call
 Using LEA instruction: 1.4 ns/call
Using ADD instructions: 0.4 ns/call


64-bit version, 10 runs in a row using a command shell for cycle, ADD before 
LEA:

CPU = Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz
-----------------------------------------------
   Pascal control case: 0.2 ns/call
Using ADD instructions: 1.4 ns/call
 Using LEA instruction: 1.6 ns/call
CPU = Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz
-----------------------------------------------
   Pascal control case: 0.2 ns/call
Using ADD instructions: 1.3 ns/call
 Using LEA instruction: 1.8 ns/call
CPU = Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz
-----------------------------------------------
   Pascal control case: 1.2 ns/call
Using ADD instructions: 0.0 ns/call
 Using LEA instruction: 1.6 ns/call
CPU = Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz
-----------------------------------------------
   Pascal control case: 1.1 ns/call
Using ADD instructions: 0.0 ns/call
 Using LEA instruction: 1.7 ns/call
CPU = Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz
-----------------------------------------------
   Pascal control case: 0.8 ns/call
Using ADD instructions: 0.0 ns/call
 Using LEA instruction: 1.6 ns/call
CPU = Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz
-----------------------------------------------
   Pascal control case: 0.7 ns/call
Using ADD instructions: 0.0 ns/call
 Using LEA instruction: 1.7 ns/call
CPU = Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz
-----------------------------------------------
   Pascal control case: 0.2 ns/call
Using ADD instructions: 1.9 ns/call
 Using LEA instruction: 0.7 ns/call
CPU = Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz
-----------------------------------------------
   Pascal control case: 0.1 ns/call
Using ADD instructions: 1.7 ns/call
 Using LEA instruction: 0.8 ns/call
CPU = Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz
-----------------------------------------------
   Pascal control case: 0.1 ns/call
Using ADD instructions: 1.5 ns/call
 Using LEA instruction: 1.6 ns/call
CPU = Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz
-----------------------------------------------
   Pascal control case: 1.2 ns/call
Using ADD instructions: 0.2 ns/call
 Using LEA instruction: 1.4 ns/call
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to