Re: [fpc-devel] "class of TFoo".Create

2025-07-06 Thread J. Gareth Moreton via fpc-devel
if that's what they meant, or a metaclass variable. Kit On 06/07/2025 15:41, Marco van de Voort via fpc-devel wrote: Op 6-7-2025 om 16:31 schreef J. Gareth Moreton via fpc-devel: What I mean is that if you want to instantiate an object of class TFoo, you'd call TFoo.Create, not TFooCla

Re: [fpc-devel] "class of TFoo".Create

2025-07-06 Thread J. Gareth Moreton via fpc-devel
What I mean is that if you want to instantiate an object of class TFoo, you'd call TFoo.Create, not TFooClass.Create. If you want to take advantage of Object Pascal's unique polymorphism and instantiate a descendant class of TFoo, you'd call MetaClassVariable.Create rather than TFooClass.Creat

Re: [fpc-devel] "class of TFoo".Create

2025-07-06 Thread J. Gareth Moreton via fpc-devel
I would personally call that unusual at best.  Logically I would consider it a type mismatch or a syntax error of some kind, since TFoo is a class and TFooClass is a metaclass.  Also, if I saw such code in a project, I would think someone made a mistake that didn't get caught, since TFoo.Create

Re: [fpc-devel] fpc_ compilerproc

2025-06-24 Thread J. Gareth Moreton via fpc-devel
If I'm right in thinking, things like "fpc_abs_real" are fallback functions that have to be overridden by a platform-specific implementation, and return runtime errors if they aren't implemented.  In many cases, such internal compiler routines are not called at all because there's a direct inst

Re: [fpc-devel] FPC 3.2.4-rc1 available

2025-06-23 Thread J. Gareth Moreton via fpc-devel
I hope there's time for this.  If this merge request is approved, can it be cherry-picked for 3.2.4 as well? https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/1049 It fixes a bug in the register allocator that I have reason to believe has been around for some time. Kit On 21/06/

Re: [fpc-devel] Can't run i386-linux tests

2025-06-13 Thread J. Gareth Moreton via fpc-devel
to everyone who had to put up with this in their Inboxes!  Still, it might serve to be a useful future reference. Gareth aka. Kit On 13/06/2025 17:09, J. Gareth Moreton via fpc-devel wrote: The reason why you didn't get the ZIP is because I forgot to attach the bloody thing!! Oops.  Here it

Re: [fpc-devel] Can't run i386-linux tests

2025-06-13 Thread J. Gareth Moreton via fpc-devel
27; Makefile:3027: recipe for target 'full' failed make: *** [full] Error 2 Gareth aka. Kit On 13/06/2025 15:56, Tomas Hajny via fpc-devel wrote: On 2025-06-13 16:04, J. Gareth Moreton via fpc-devel wrote: Hi Gareth, Here's the full log (as a ZIP since the raw text file is over 100

Re: [fpc-devel] Can't run i386-linux tests

2025-06-13 Thread J. Gareth Moreton via fpc-devel
quot; to the make call? It probably has a problem with the process unit from release installation... But I would like to confirm that this is indeed the issue. Pierre Le 13/06/2025 à 13:08, J. Gareth Moreton via fpc-devel a écrit : Hi Pierre, Here attached is the log of me running 'make'

Re: [fpc-devel] Can't run i386-linux tests

2025-06-13 Thread J. Gareth Moreton via fpc-devel
full log of the failing make command? Pierre Le 12/06/2025 à 08:27, J. Gareth Moreton via fpc-devel a écrit : Hi everyone, There seems to be a problem on i386-linux on the trunk in that I can't run the test suite.  After successfully building the compiler, I then go to the "tests&qu

[fpc-devel] Can't run i386-linux tests

2025-06-11 Thread J. Gareth Moreton via fpc-devel
Hi everyone, There seems to be a problem on i386-linux on the trunk in that I can't run the test suite.  After successfully building the compiler, I then go to the "tests" subdirectory and run "make clean full TEST_OPT=~/Documents/fpc-opts/compiler/ppc386" and get the following error: Compil

Re: [fpc-devel] APX instruction set

2025-05-21 Thread J. Gareth Moreton via fpc-devel
FPC is always going to be a bit behind the curve because gcc, for example, has corporate sponsors.  Heck, when I interviewed for a role at ARM (which I didn't get), they made clear that they help develop GCC and LLVM directly.  Can't easily compete with the actual CPU manufacturers contributing

[fpc-devel] Vectorisation development

2025-05-18 Thread J. Gareth Moreton via fpc-devel
Hi everyone, Just thought I'd give a heads-up on my latest mad experiments! I'm currently working to see if I can improve auto-vectorisation within the compiler.  I'm using x86_64 as my starting point since SSE2 is guaranteed to be present, but aiming to make it as cross-platform as possible

Re: [fpc-devel] Test fix

2025-04-26 Thread J. Gareth Moreton via fpc-devel
because in many cases the time interval is too short to get any value. Pierre Le 26/04/2025 à 23:50, J. Gareth Moreton via fpc-devel a écrit : If it's okay, can I rename the define from "IN_TESTS" to "CONFORMANCE" or similar?  Technically, the code in "bcase" and &

Re: [fpc-devel] Test fix

2025-04-26 Thread J. Gareth Moreton via fpc-devel
that the compiler has produced correct code. Kit On 25/04/2025 22:00, J. Gareth Moreton via fpc-devel wrote: "Just one small remark: why do you use '$8' instead of simply '8'?" Mostly habit because the tests use "Iteration and 7" to select the ind

[fpc-devel] tests/test/tset6.pp failure

2025-04-25 Thread J. Gareth Moreton via fpc-devel
Hi everyone, I'm curious behind the continuous failure of tests/test/tset6.pp - is it a feature that hasn't been implemented yet or a parser problem? Kit -- This email has been checked for viruses by Avast antivirus software. www.avast.com ___ fpc-

Re: [fpc-devel] Test fix

2025-04-25 Thread J. Gareth Moreton via fpc-devel
lure...   I have no objection to your patch, please go ahead and commit. For tests/bench/bcase.pp, I had to set ITERATIONS To $1 to avoid errors...   Just one small remark: why do you use '$8' instead of simply '8'? Pierre Le 25/04/2025 à 21:52, J. Gareth Moreton via fp

[fpc-devel] Test fix

2025-04-25 Thread J. Gareth Moreton via fpc-devel
Hi everyone, I just fixed an issue with tests/bench/bfloatfunc.pp over at https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/996 failing due to the reduced iteration count.  I've increased it from 1 to 8 when in conformance mode (in IN_TESTS defined), since if it's less than that,

[fpc-devel] System / Math unit problems (BaseMath?)

2025-04-22 Thread J. Gareth Moreton via fpc-devel
Hi everyone, Has there been any decision on what to do with mathematical functionality that's shared across units?  I bring this up because while trying to optimise an internal mathematical routine (ldexp), I discovered there are two different versions in use - one in the Math unit and a priv

Re: [fpc-devel] Current work

2024-08-24 Thread J. Gareth Moreton via fpc-devel
Thanks Denis, I have to be slightly careful though because the example I gave with "addps" is not actually correct, because (%r8) could be unaligned (it works fine with "vaddps" though due to a paradigm change in the design of AVX compared to SSE).  In this situation a more correct example wou

Re: [fpc-devel] Current work

2024-08-23 Thread J. Gareth Moreton via fpc-devel
s, and there may be some unnecessary reads and writes between the stack and XMM registers, but I'm working on it, bit by it. My current branch can be found here: https://gitlab.com/CuriousKit/optimisations/-/commits/ucomplex-x86-vector Kit On 23/08/2024 17:56, J. Gareth Moreton via fpc-devel

Re: [fpc-devel] Current work

2024-08-23 Thread J. Gareth Moreton via fpc-devel
Should I use a compiler definition instead like "-dX86_VECTORS"? That way, the feature can easily be turned off. Kit On 21/08/2024 15:59, J. Gareth Moreton via fpc-devel wrote: Hi everyone, Just thought I'd give a heads-up on what's happening with me and the compiler imp

[fpc-devel] Current work

2024-08-21 Thread J. Gareth Moreton via fpc-devel
Hi everyone, Just thought I'd give a heads-up on what's happening with me and the compiler improvements.  Also, I've been busy with contract work and have just had some minor surgery, so I'm not running on all cylinders currently. * Still waiting on administrator comments and feedback on my

Re: [fpc-devel] pure function feedback

2024-07-02 Thread J. Gareth Moreton via fpc-devel
Fixed!  Thanks again Marģers. Kit On 01/07/2024 18:09, Marģers . wrote: > Fixed 2 and 3. Thank you. one more ... {\$ifdef FPU_HAS_PURE}pure;{\$ENDIF} FPU_HAS_PURE probably is typo and should be: FPC_HAS_PURE -- This email has been checked for viruses by Avast antivirus software. www.avas

Re: [fpc-devel] pure function feedback

2024-07-01 Thread J. Gareth Moreton via fpc-devel
Oh yes, that's a silly mistake!  Easy enough to fix hopefully. Kit On 01/07/2024 18:09, Marģers . wrote: > Fixed 2 and 3. Thank you. one more ... {\$ifdef FPU_HAS_PURE}pure;{\$ENDIF} FPU_HAS_PURE probably is typo and should be: FPC_HAS_PURE -- This email has been checked for viruses by A

Re: [fpc-devel] pure function feedback

2024-07-01 Thread J. Gareth Moreton via fpc-devel
On a related note, I do wonder where pure functions might help with JIT.  It depends on what Florian and the other administrators and developers seek, but currently I aim for my pure function implementation to fulfil both standard properties (1. same output for the same input(s), and 2. no side

Re: [fpc-devel] pure function feedback

2024-07-01 Thread J. Gareth Moreton via fpc-devel
In the case of JVM, the JIT compiler is specific to Java, I think.  Normally JIT requires the source code to be compiled into an intermediate bytecode first (e.g. Java bytecode or the Common Intermediate Language (.NET)). Kit On 01/07/2024 09:33, Mattias Gaertner via fpc-devel wrote: On 7/

Re: [fpc-devel] pure function feedback

2024-07-01 Thread J. Gareth Moreton via fpc-devel
Aah, thanks Marco.  I still have some things to learn about FPC! Kit On 01/07/2024 08:05, Marco van de Voort via fpc-devel wrote: Op 1-7-2024 om 02:34 schreef Hairy Pixels via fpc-devel: I had a question about pure functions. I'm seeing some newer languages have a JIT built-in so they can run

Re: [fpc-devel] pure function feedback

2024-06-30 Thread J. Gareth Moreton via fpc-devel
re functions? It seems like the JIT is actually easier to implement than all this complicated node analysis, but probably slower to run I may guess. I think the LLVM backend could do this but the main code generator I'm not sure. On Jun 30, 2024, at 9:17 AM, J. Gareth Moreton via fpc-de

Re: [fpc-devel] pure function feedback

2024-06-29 Thread J. Gareth Moreton via fpc-devel
in the code. Merge request has been updated - I have also added two new tests based on your examples.  Thanks again Marģers. Kit On 28/06/2024 13:24, J. Gareth Moreton via fpc-devel wrote: Hi Marģers, Thanks for the feedback! Assigning the results of pure functions to constants has not yet bee

[fpc-devel] Faster trig functions

2024-06-28 Thread J. Gareth Moreton via fpc-devel
Hi everyone, So for a few weeks now, I've been playing with the idea of speeding up the trig functions in Free Pascal, or at least the trig functions for Single-precision which find uses in graphical applications where deep precision is not absolutely necessary, but speed is paramount.  Never

Re: [fpc-devel] pure function feedback

2024-06-28 Thread J. Gareth Moreton via fpc-devel
Hi Marģers, Thanks for the feedback! Assigning the results of pure functions to constants has not yet been developed.  I had planned to add it once the bulk of pure functions (i.e. the current merge request) had been approved since it requires some additional work (specifically what happens i

Re: [fpc-devel] Question about internal compiler functions

2024-06-25 Thread J. Gareth Moreton via fpc-devel
On 25/06/2024 18:24, J. Gareth Moreton via fpc-devel wrote: Hi everyone, This might be the silliest question, but where are functions like fpc_sin_real defined and implemented in the compiler, specifically for x86_64?  I'm playing around with a faster algorithm but can't seem to

[fpc-devel] Question about internal compiler functions

2024-06-25 Thread J. Gareth Moreton via fpc-devel
Hi everyone, This might be the silliest question, but where are functions like fpc_sin_real defined and implemented in the compiler, specifically for x86_64?  I'm playing around with a faster algorithm but can't seem to find the actual files where the code is implemented. Functions like fpc_f

Re: [fpc-devel] Freeze of fixes for 3.2.4 by 9th June

2024-06-10 Thread J. Gareth Moreton via fpc-devel
extra test case. Kit On 10/06/2024 21:54, Florian Klämpfl via fpc-devel wrote: On 05.06.24 13:16, J. Gareth Moreton via fpc-devel wrote: Uncertain if this one has been added or not: https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/218 - this one fixes a bug with division node

Re: [fpc-devel] Freeze of fixes for 3.2.4 by 9th June

2024-06-08 Thread J. Gareth Moreton via fpc-devel
*From:* J. Gareth Moreton via fpc-devel < fpc-devel@lists.freepascal.org> *To:* < fpc-devel@lists.freepascal.org> If you've got the commit(s) to hand, there's still time! Kit On 08/06/2024 14:00, Marģers . via fpc-devel wrote: Is there a reason why missing

Re: [fpc-devel] Freeze of fixes for 3.2.4 by 9th June

2024-06-08 Thread J. Gareth Moreton via fpc-devel
If you've got the commit(s) to hand, there's still time! Kit On 08/06/2024 14:00, Marģers . via fpc-devel wrote: Is there a reason why missing x86 assembler instructions have not made to fixes (except for avx512, that would be too much)? To get finally forward with the 3.2.4 release, fixe

Re: [fpc-devel] Freeze of fixes for 3.2.4 by 9th June

2024-06-05 Thread J. Gareth Moreton via fpc-devel
Uncertain if this one has been added or not: https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/218 - this one fixes a bug with division nodes Commits are: 54aae023ea2f4ee864c4ef3ce98ad387c166cb52 - bug fix fb14bc845943073730f66be5c0450fe08afca276 - tests Kit On 02/06/2024 21:28,

Re: [fpc-devel] Freeze of fixes for 3.2.4 by 9th June

2024-06-03 Thread J. Gareth Moreton via fpc-devel
P.S. That's commit abf89eea0d6a36add99bfbcb6a0cedcec18cca59 On 03/06/2024 22:33, Adriaan van Os via fpc-devel wrote: Florian Klämpfl via fpc-devel wrote: To get finally forward with the 3.2.4 release, fixes will be frozen by 9th June, so if there are some last second cherry picks needed, now i

Re: [fpc-devel] Peephole issue in 3.2.3

2024-06-02 Thread J. Gareth Moreton via fpc-devel
evel wrote: On 02/06/2024 21:06, J. Gareth Moreton via fpc-devel wrote: I admit I'm not overly sure how to handle Thaddy sometimes: "They fixed it in the wrong way. It is fixed in a way to solve a single - rare - problem by an OP that seems to have more infuence than me and the fixer

Re: [fpc-devel] Peephole issue in 3.2.3

2024-06-02 Thread J. Gareth Moreton via fpc-devel
referring to exactly.  Hopefully not my aforementioned commit, because I think making sure the flag register is properly allocated so the peephole optimizer can make the correct informed choices is pretty important! Kit On 02/06/2024 11:51, J. Gareth Moreton via fpc-devel wrote: I made a post on that

Re: [fpc-devel] Peephole issue in 3.2.3

2024-06-02 Thread J. Gareth Moreton via fpc-devel
I made a post on that topic, as I remember that bug.  It was a peephole optimisation that I introduced, but before anyone tries to lynch me for breaking the compiler, the reason why things broke is because it makes the optimisation on the assumption that the FLAGS register was not in use.  Howe

Re: [fpc-devel] x86 assembler improvements, patch

2024-05-29 Thread J. Gareth Moreton via fpc-devel
Heh, that's fair.  It was essentially how we did it in the past anyway! Kit On 29/05/2024 22:08, Florian Klämpfl via fpc-devel wrote: On 29.05.24 13:09, J. Gareth Moreton via fpc-devel wrote: Shouldn't this be made as a merge request? I am sure we can handle also such patc

Re: [fpc-devel] x86 assembler improvements, patch

2024-05-29 Thread J. Gareth Moreton via fpc-devel
Shouldn't this be made as a merge request? On 28/05/2024 07:12, Marģers . via fpc-devel wrote: Some compiler x86 assembler improvements 1) patch for fpc 3.3.1 (attachment: mkx86ins_version_bump.patch) compiler/utils/mkx86ins.pp Version bumped from 1.6.1 to 1.6.2 There has been changes to code,

Re: [fpc-devel] Windows for AArch64

2024-05-26 Thread J. Gareth Moreton via fpc-devel
, although I'm not sure if it's a permissions issue or a subtle fault with the pointers.  This may require refactoring later on or if bugs manifest in larger projects. Kit On 26/05/2024 21:33, J. Gareth Moreton via fpc-devel wrote: Thank you for all your assistance with this Sven.

Re: [fpc-devel] Windows for AArch64

2024-05-26 Thread J. Gareth Moreton via fpc-devel
g the jump table in the same section as the actual code) unfortunately didn't work, so it's something more subtle. Kit On 26/05/2024 11:55, Sven Barth via fpc-devel wrote: J. Gareth Moreton via fpc-devel schrieb am Sa., 25. Mai 2024, 22:18: Indeed - I'm not giving up!  I

Re: [fpc-devel] Windows for AArch64

2024-05-25 Thread J. Gareth Moreton via fpc-devel
e! Kit On 25/05/2024 16:42, Sven Barth via fpc-devel wrote: J. Gareth Moreton via fpc-devel schrieb am Sa., 25. Mai 2024, 10:49: Thought I'd give a small update. I was distracted over the past month with work, the arm-linux blocking bug and a couple of merge requests whi

Re: [fpc-devel] Windows for AArch64

2024-05-25 Thread J. Gareth Moreton via fpc-devel
ndle. Gareth aka. Kit On 29/04/2024 21:31, Sven Barth via fpc-devel wrote: Am 29.04.2024 um 08:42 schrieb J. Gareth Moreton via fpc-devel: Aah, partially answered.  It's not supported in 3.2.2, but there is better support for it in the trunk. You had me worried there for a mome

Re: [fpc-devel] Windows for AArch64

2024-04-29 Thread J. Gareth Moreton via fpc-devel
Thanks Sven.  I'm predicting a future of Windows on AArch64, since Windows is not going anywhere but Arm processors are starting to really take off beyond mobile devices. Kit On 29/04/2024 21:31, Sven Barth via fpc-devel wrote: Am 29.04.2024 um 08:42 schrieb J. Gareth Moreton via fpc-

Re: [fpc-devel] Windows for AArch64

2024-04-28 Thread J. Gareth Moreton via fpc-devel
Aah, partially answered.  It's not supported in 3.2.2, but there is better support for it in the trunk. Kit On 29/04/2024 06:42, J. Gareth Moreton via fpc-devel wrote: Hi everyone, I may need some help with this one.  Is there a tried and tested way of getting FPC to build and insta

[fpc-devel] Windows for AArch64

2024-04-28 Thread J. Gareth Moreton via fpc-devel
Hi everyone, I may need some help with this one.  Is there a tried and tested way of getting FPC to build and install on aarch64-win64? (I assume that's the correct OS for Windows for ARM64).  The make script doesn't seem to accept the combination of CPU_TARGET=aarch64 OS_TARGET=win64 and it's

Re: [fpc-devel] Free Pascal for Windows aarch64 Bug Bounties

2024-04-27 Thread J. Gareth Moreton via fpc-devel
I figured that would be the case with the PE format.  Fun times ahead! Kit On 27/04/2024 13:06, Sven Barth via fpc-devel wrote: J. Gareth Moreton via fpc-devel schrieb am Sa., 27. Apr. 2024, 10:00: You've piqued my interest.  I currently only have the ability to develop on aa

Re: [fpc-devel] error target i386 -Cp80486

2024-04-23 Thread J. Gareth Moreton via fpc-devel
ntenance since I shouldn't need to set the operand sizes, but I'll save that for another day. On 24/04/2024 05:08, J. Gareth Moreton via fpc-devel wrote: I've gotten back as far as here, and it's still bad: commit 7fbda0e0e8b1d071e72ccbc5e487dbb1c2173c63 (HEAD) Auth

Re: [fpc-devel] error target i386 -Cp80486

2024-04-23 Thread J. Gareth Moreton via fpc-devel
y because 3.2.2 doesn't work.  However the hang (and also an eventual out of memory error) doesn't occur if -OoNOPEEPHOLE is specified, meaning the problem is located in the peephole optimizer.  So it looks like I'll have to try to debug this the hard way! Kit On 23/04/2024 17

Re: [fpc-devel] error target i386 -Cp80486

2024-04-23 Thread J. Gareth Moreton via fpc-devel
I've reproduced the hang doing "make clean all CPU_TARGET=i386 OS_TARGET=win32 OPT="-Cp80486 -Op80486"" on my x86_64-win64 machine. So far I haven't found the bad commit - this problem has been here a while. Kit I still haven't found the bad commit! On 23/0

Re: [fpc-devel] error target i386 -Cp80486

2024-04-23 Thread J. Gareth Moreton via fpc-devel
Absolutely I can.  I'll see what I can find. Gareth aka. Kit On 23/04/2024 12:09, Tomas Hajny via fpc-devel wrote: On 2024-04-23 11:50, Marģers . via fpc-devel wrote: 1) does not work make clean singlezipinstall OS_TARGET=win32 CPU_TARGET=i386 ALLOW_WARNINGS=1 OPT="  -O2 -vxitl -Cp80486 -Op804

[fpc-devel] Planning refactor of x86 OptPass1MOV

2024-04-15 Thread J. Gareth Moreton via fpc-devel
Hi everyone, While I'm starting to focus more on node-level optimisations, since they benefit more platforms and can produce better optimisations in some situations due to cross-platform support and things like register allocation, I'm thinking about refactoring and improving x86's OptPass1MO

Re: [fpc-devel] wrong result for abs(low(int64))

2024-04-04 Thread J. Gareth Moreton via fpc-devel
Essentially, an arithmetic overflow is happening.  Since the largest Int64 possible is 9,223,372,036,853,775,807, going one above that (the result to abs(low(int64))) wraps back around to -9,223,372,036,853,775,808. Internally, you can think about negating (positing?) a negative number as inve

Re: [fpc-devel] Unaligned access on Cortex-M0 in Initialization code

2024-03-31 Thread J. Gareth Moreton via fpc-devel
Oops - I'm sorry for my introduced bug! Gareth aka. Kit On 31/03/2024 21:48, Michael Ring via fpc-devel wrote: Works, thank you! Michael Am 31.03.24 um 22:18 schrieb Florian Klämpfl via fpc-devel: Am 31.03.2024 um 21:58 schrieb Michael Ring via fpc-devel : This is what I see (guess the

Re: [fpc-devel] i386-win32 -CriotR fails to build

2024-03-01 Thread J. Gareth Moreton via fpc-devel
Excellent, thank you Michael. Kit On 01/03/2024 20:56, Michael Van Canneyt via fpc-devel wrote: On Fri, 1 Mar 2024, J. Gareth Moreton via fpc-devel wrote: Just want to confirm that the failure also occurs on x86_64-win64 under -CriotR rules. On all platforms. I fixed compilation with

Re: [fpc-devel] i386-win32 -CriotR fails to build

2024-03-01 Thread J. Gareth Moreton via fpc-devel
Just want to confirm that the failure also occurs on x86_64-win64 under -CriotR rules. Kit On 01/03/2024 18:18, J. Gareth Moreton via fpc-devel wrote: Hi everyone. As part of my automated tests I try to build the compiler and packages on i386-win32 under the options "-O4 -CriotR".

[fpc-devel] i386-win32 -CriotR fails to build

2024-03-01 Thread J. Gareth Moreton via fpc-devel
Hi everyone. As part of my automated tests I try to build the compiler and packages on i386-win32 under the options "-O4 -CriotR".  Doing so gives a failure with the vcl_compat package (the failure also occurs with just "-CriotR").  Can others confirm? External command "C:/Users/garet/Docum

Re: [fpc-devel] ARM: AND/CMP -> TST optimisation produces incorrect results

2024-02-28 Thread J. Gareth Moreton via fpc-devel
Hi Garry, Hopefully I have fixed this issue now, which is also causing problems elsewhere. https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/598 - just waiting on it to be verified, approved and merged. Gareth aka. Kit On 20/02/2024 06:32, J. Gareth Moreton via fpc-devel wrote

[fpc-devel] Possible bug in "chmreader"

2024-02-21 Thread J. Gareth Moreton via fpc-devel
Hi everyone, While evaluating a new peephole optimisation, I came across a null pointer dereference in the assembly language.  After looking at the original Pascal code, I came across this starting at line 525 of packages/chm/src/chmreader.pas: procedure TChmReader.ReadWindows(mem:TMemoryStr

Re: [fpc-devel] ARM: AND/CMP -> TST optimisation produces incorrect results

2024-02-19 Thread J. Gareth Moreton via fpc-devel
Thanks for the report and especially your investigative work. Ii'll take a look to see what's going on. Gareth aka. Kit On 20/02/2024 01:30, Garry Wood via fpc-devel wrote: Hello, Commit 6b2e4fa4 (main) entitled “* arm: "OpCmp2OpS" moved to Pass 2 so it doesn't conflict with AND; CMP -> TST

[fpc-devel] Compiler warning when built with -dDEBUG_NODE_XML

2024-02-14 Thread J. Gareth Moreton via fpc-devel
Hi everyone, After some recent updates to the trunk, the compiler no longer successfully builds when -dDEBUG_NODE_XML is specified: symsym.pas(2885,9) Warning: (treated as error) Case statement does not handle all possible cases This is located within "procedure TConstSym.XMLPrintConstData(

Re: [fpc-devel] Modifiers...

2024-01-24 Thread J. Gareth Moreton via fpc-devel
Note that for 1), it should be "end.", not "end;" - make sure that isn't causing your error. Subroutine directives like "vectorcall" I think are usable as variable names. Kit On 24/01/2024 22:29, Martin Frb via fpc-devel wrote: https://www.freepascal.org/docs-html/ref/refsu3.html Is this l

[fpc-devel] Internal "Signed wrap" function

2023-12-01 Thread J. Gareth Moreton via fpc-devel
Hi everyone, I'm just fixing a bugged optimisation, and I came across a situation where I need to essentially do a "signed wrap" of a constant.  At one point I'm optimising "subl $-12,%eax", "addl $1,%eax" into a single instruction, but to make sure (untrapped) overflows are handled correctly

[fpc-devel] Accidental file inclusion in repository

2023-11-29 Thread J. Gareth Moreton via fpc-devel
Hi everyone, I hate to point fingers, but there's a 0-byte file named "HEAD" in the repository, which causes git to throw a tantrum sometimes - it was introduced in the following commit: commit a4c324ee237674950e4675894df386519b75a130 Author: Rika Ichinose Date:   Fri Apr 14 09:24:55 2023 +0

[fpc-devel] Interesting short article about optimisation

2023-11-25 Thread J. Gareth Moreton via fpc-devel
I just stumbled across this article about micro-architecture-specific optimisations in ARM: https://www.phoronix.com/news/ARM64-Linux-No-Uarch-Opts They briefly mention x86_64, and I agree it's good to avoid micro-architecture-specific optimisations and now it makes me wonder where the line i

[fpc-devel] Arm compiler limitation

2023-11-23 Thread J. Gareth Moreton via fpc-devel
Hi everyone, So one of my recent merge requests (https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/516) has been having test failures on arm-linux, and this has confused me for a while because they don't occur on aarch64-linux (the two platforms share the same code in this particu

[fpc-devel] Quirk is "IsJumpToLabel"

2023-11-10 Thread J. Gareth Moreton via fpc-devel
Hi everyone, I've been developing a new optimisation for x86, and in one situation a JMP becomes a Jcc.  To make sure it's valid, I ensure that "IsJumpToLabel" returns True before the change is made.  All was well in x86_64-win64 and x86_64-linux, but on i386-linux, I came across a bit of an

Re: [fpc-devel] Kit's current work

2023-11-08 Thread J. Gareth Moreton via fpc-devel
On 08/11/2023 21:11, Florian Klämpfl via fpc-devel wrote: Am 08.11.2023 um 21:22 schrieb J. Gareth Moreton via fpc-devel: - I don't know what the eventual support for intrinsics will be for FPC, if it will ever get implemented, but I at the very least hope the internal nodes wil

[fpc-devel] Kit's current work

2023-11-08 Thread J. Gareth Moreton via fpc-devel
Hi everyone, I just thought I'd give a heads up on what I'm currently doing for the Free Pascal Compiler. - Pure functions are still my main target.  There are a few sticking points that I'm trying to resolve, like handling certain internal functions and how to deal with out variables that g

[fpc-devel] Optimisation question

2023-10-30 Thread J. Gareth Moreton via fpc-devel
Hi everyone, I'm still exploring optimisations in generated x86 code, something which has become my speciality, and I found one new potential optimisation sequence that aims to reduce unnecessary calls to CMP and TEST when the result is already known.  However there are some situations where I

Re: [fpc-devel] LEA instruction speed

2023-10-27 Thread J. Gareth Moreton via fpc-devel
I should have figured.  Thank you! Kit On 27/10/2023 01:51, Nikolay Nikolov via fpc-devel wrote: On 10/11/23 11:21, Tomas Hajny via fpc-devel wrote: On 2023-10-11 04:15, J. Gareth Moreton via fpc-devel wrote: Sweet, thank you.  Would you be willing to share your modified test's sour

Re: [fpc-devel] LEA instruction speed

2023-10-13 Thread J. Gareth Moreton via fpc-devel
ility' test.  The feedback from others has proven useful in determining the correctness of the new optimisation hint, which I intend to use to make the i386/x86_64 peephole optimizer smarter in regards to using LEA statements. Kit On 13/10/2023 16:36, Tomas Hajny via fpc-devel wrote: On 2023

Re: [fpc-devel] LEA instruction speed

2023-10-13 Thread J. Gareth Moreton via fpc-devel
This one's for you Stefan! https://github.com/spring4d/benchmark/issues/4 Kit On 13/10/2023 16:03, Tomas Hajny via fpc-devel wrote: On 2023-10-13 16:25, J. Gareth Moreton via fpc-devel wrote: GetLogicalProcessorInformation returns a Boolean - if false, an error occurred, and is handl

Re: [fpc-devel] LEA instruction speed

2023-10-13 Thread J. Gareth Moreton via fpc-devel
l wrote: On 2023-10-13 16:25, J. Gareth Moreton via fpc-devel wrote: GetLogicalProcessorInformation returns a Boolean - if false, an error occurred, and is handled as follows: DiagnoseAndExit('Failed during call to GetLogicalProcessorInformation: ' + GetLastError.ToString); GetLastErro

Re: [fpc-devel] LEA instruction speed

2023-10-13 Thread J. Gareth Moreton via fpc-devel
23 08:34, Tomas Hajny via fpc-devel wrote: On 2023-10-13 09:26, Tomas Hajny wrote: On 2023-10-12 20:02, J. Gareth Moreton via fpc-devel wrote: So an update.  .  . The latest version of blea.pp doesn't compile with a 32-bit compiler - line 76 contains an unconditional reference to R8 register

Re: [fpc-devel] LEA instruction speed

2023-10-13 Thread J. Gareth Moreton via fpc-devel
(it's replaced with "CPUName" on 32-bit).  I wasn't sure if global variables were initialised or not, hence me playing safe. Kit On 13/10/2023 08:34, Tomas Hajny via fpc-devel wrote: On 2023-10-13 09:26, Tomas Hajny wrote: On 2023-10-12 20:02, J. Gareth Moreton via fpc-deve

Re: [fpc-devel] LEA instruction speed

2023-10-12 Thread J. Gareth Moreton via fpc-devel
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 Benchmar

[fpc-devel] 47k attachment

2023-10-12 Thread J. Gareth Moreton via fpc-devel
To whom it may concern, I have a new message for the "LEA instruction speed" chain, but it is currently in holding as it contains a 47k ZIP file (source code only, and a third-party licence agreement).  Can the mailing list maintainer confirm (or deny) that it's okay? Kit __

Re: [fpc-devel] LEA instruction speed

2023-10-10 Thread J. Gareth Moreton via fpc-devel
2023 at 11:13 AM J. Gareth Moreton via fpc-devel wrote: Thanks Tomas, Nothing is broken, but the timing measurement isn't precise enough. Normally I have a much higher iteration count (e.g. 1,000,000), but I had reduced it to 10,000 because, coupled with the 1,000 iterations in the subrout

Re: [fpc-devel] LEA instruction speed

2023-10-10 Thread J. Gareth Moreton via fpc-devel
Sweet, thank you.  Would you be willing to share your modified test's source? I was worried that if CPUID wasn't present it would cause a SIGILL. Kit On 11/10/2023 01:47, Tomas Hajny via fpc-devel wrote: On 2023-10-10 13:24, J. Gareth Moreton via fpc-devel wrote: I'm al

Re: [fpc-devel] LEA instruction speed

2023-10-10 Thread J. Gareth Moreton via fpc-devel
tend to be very heavily used, while AGUs tend to be used one at a time. On 10/10/2023 11:54, Tomas Hajny via fpc-devel wrote: On 2023-10-10 12:19, Marco van de Voort via fpc-devel wrote: Op 10-10-2023 om 11:13 schreef J. Gareth Moreton via fpc-devel: Thanks Tomas, Nothing is broken, but the timi

Re: [fpc-devel] LEA instruction speed

2023-10-10 Thread J. Gareth Moreton via fpc-devel
Ooo, that might be just what we need.  Thank you Stefan. Kit On 10/10/2023 10:57, Stefan Glienke via fpc-devel wrote: Be my guest making https://github.com/spring4d/benchmark compatible for all platforms you need it for. On 10/10/2023 11:13 CEST J. Gareth Moreton via fpc-devel wrote

Re: [fpc-devel] LEA instruction speed

2023-10-10 Thread J. Gareth Moreton via fpc-devel
e). 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

Re: [fpc-devel] LEA instruction speed

2023-10-10 Thread J. Gareth Moreton via fpc-devel
very slow routines.  Still, let's see if 100,000 gives better results for you. Kit On 10/10/2023 09:57, Tomas Hajny wrote: 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 na

Re: [fpc-devel] LEA instruction speed

2023-10-09 Thread J. Gareth Moreton via fpc-devel
haven't broken something. Kit 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 ex

Re: [fpc-devel] LEA instruction speed

2023-10-09 Thread J. Gareth Moreton via fpc-devel
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 sligh

Re: [fpc-devel] LEA instruction speed

2023-10-09 Thread J. Gareth Moreton via fpc-devel
nts Ettumanoor, INDIA Ph:+91 9443211326 On Sun, Oct 8, 2023 at 6:40 PM J. Gareth Moreton via fpc-devel wrote: 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

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 cond

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 - fpc-devel@lists.freepascal.

Re: [fpc-devel] LEA instruction speed

2023-10-08 Thread J. Gareth Moreton via fpc-devel
logy Consultants Ettumanoor, INDIA Ph:+91 9443211326 On Sat, Oct 7, 2023 at 9:39 PM J. Gareth Moreton via fpc-devel wrote: That's interesting; I am interested to see the assembly output for the Pascal control cases.  As for the 64-bit version, that was my fault since the

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&#

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 l

Re: [fpc-devel] LEA instruction speed

2023-10-07 Thread J. Gareth Moreton via fpc-devel
ur testing on an AMD 486 shows it is at least as fast as two ADDs in a dependency chain. That should be all the information I need - thanks again! Kit On 07/10/2023 19:03, Tomas Hajny via fpc-devel wrote: On 2023-10-07 18:09, J. Gareth Moreton via fpc-devel wrote: That's interesting; I

Re: [fpc-devel] LEA instruction speed

2023-10-07 Thread J. Gareth Moreton via fpc-devel
tached the fixed test. Kit P.S. Results on my Intel(R) Core(TM) i7-10750H    Pascal control case: 2.0 ns/call  Using LEA instruction: 1.7 ns/call Using ADD instructions: 1.3 ns/call On 07/10/2023 16:51, Tomas Hajny via fpc-devel wrote: On 2023-10-07 03:57, J. Gareth Moreton via fpc-devel wrote

Re: [fpc-devel] LEA instruction speed

2023-10-06 Thread J. Gareth Moreton via fpc-devel
Hi Tomas, Do you think this should suffice? Originally it ran for 1,000,000 repetitions but I fear that will take way too long on a 486, so I reduced it to 10,000. Kit On 03/10/2023 06:30, Tomas Hajny via fpc-devel wrote: On October 3, 2023 03:32:34 +0200, "J. Gareth Moreton via fpc-

Re: [fpc-devel] LEA instruction speed

2023-10-03 Thread J. Gareth Moreton via fpc-devel
ote: Am 03.10.2023 um 03:32 schrieb J. Gareth Moreton via fpc-devel : Hi everyone, This is mainly to Florian, but also to anyone else who can answer the question - at which point did a complex LEA instruction (using all three input operands and some other specific circumstances) get s

  1   2   3   4   5   >