Re: [fpc-devel] LEA instruction speed

2023-10-08 Thread Tomas Hajny via fpc-devel
On 2023-10-08 13:45, J. Gareth Moreton via fpc-devel wrote: Sorry, ignore last attachment - I forgot to change a line of assembly (it was correct for x86_64-win64!!). Here is the corrected version. Alright, results for this version for AMD A9 9425 under Linux (the same trunk compiler as

Re: [fpc-devel] LEA instruction speed

2023-10-08 Thread J. Gareth Moreton via fpc-devel
Did some checking of the test I copied the code from, and I forgot that Rika's original code only exited once a certain time period had elapsed (e.g. 0.5 seconds).  I had changed it to a standard iteration count since I was concerned about fairness and accuracy, but I only changed the loop

Re: [fpc-devel] LEA instruction speed

2023-10-08 Thread J. Gareth Moreton via fpc-devel
In the meantime, here's the merge request for the feature based on user tests and studying of Agner Fog's instruction tables: https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/502 Kit ___ fpc-devel maillist -

Re: [fpc-devel] LEA instruction speed

2023-10-08 Thread J. Gareth Moreton via fpc-devel
Hi Nataraj Which processor is that run on? (although too close to call, it implies LEA has a latency of 2 in that case) Kit On 08/10/2023 14:06, Nataraj S Narayan via fpc-devel wrote: Hi [nataraj@dflyHP ~]$ fpc ttt.pas Free Pascal Compiler version 3.2.2 [2023/07/04] for x86_64 Copyright

Re: [fpc-devel] LEA instruction speed

2023-10-08 Thread Nataraj S Narayan via fpc-devel
Hi [nataraj@dflyHP ~]$ fpc ttt.pas Free Pascal Compiler version 3.2.2 [2023/07/04] for x86_64 Copyright (c) 1993-2021 by Florian Klaempfl and others Target OS: DragonFly for x86-64 Compiling ttt.pas Linking ttt /usr/local/bin/ld.bfd: warning:

Re: [fpc-devel] LEA instruction speed

2023-10-08 Thread J. Gareth Moreton via fpc-devel
Sorry, ignore last attachment - I forgot to change a line of assembly (it was correct for x86_64-win64!!). Here is the corrected version. Kit On 08/10/2023 12:38, J. Gareth Moreton via fpc-devel wrote: Sorry, I got careless and was in a rush, as both the Pascal code is wrong and I didn't

Re: [fpc-devel] LEA instruction speed

2023-10-08 Thread J. Gareth Moreton via fpc-devel
Sorry, I got careless and was in a rush, as both the Pascal code is wrong and I didn't store the result of the benchmark test, hence the error check at the end returned a false negative. The benchmark code was from Rika's SHA-1 test code, which I didn't properly check, although I assumed the

Re: [fpc-devel] LEA instruction speed

2023-10-08 Thread Marģers . via fpc-devel
1. why you leave "time:=..." in benchmark loop? It does add 50% of execution time per call. 2. Pascal version does not match assembler version. Had to fix it.   //Result := X + Counter + $87654321;   Result:=Result + X + $87654321;   Result:=Result xor y; 3. Assembler functions can be