Re: [fpc-devel] Producing assembly with less branches?

2020-07-19 Thread Stefan Glienke
Am 20.07.2020 um 02:37 schrieb J. Gareth Moreton: On 19/07/2020 22:37, Stefan Glienke wrote: clang and gcc emit this - I would guess they detect quite some common patterns like this.  ...   cmp eax, edx   mov edx, -1   setg    al   movzx   eax, al   cmovl   eax, edx   ret I think I

Re: [fpc-devel] Producing assembly with less branches?

2020-07-19 Thread J. Gareth Moreton
On 19/07/2020 22:37, Stefan Glienke wrote: clang and gcc emit this - I would guess they detect quite some common patterns like this.  ...   cmp eax, edx   mov edx, -1   setg    al   movzx   eax, al   cmovl   eax, edx   ret I think I can make improvements to that already! (Note the se

Re: [fpc-devel] Producing assembly with less branches?

2020-07-19 Thread Stefan Glienke
- Reply to message - Subject: [fpc-devel] Producing assembly with less branches? From: Stefan Glienke To: Hi, not sure if anything significantly changed in trunk compared to 3.2 wrt to optimized code being generated but I am quite disappointed that fpc (checked win64 with -O3 and -O4

Re: [fpc-devel] Producing assembly with less branches?

2020-07-19 Thread Florian Klämpfl
Am 19.07.20 um 19:24 schrieb Stefan Glienke: Hi, not sure if anything significantly changed in trunk compared to 3.2 wrt to optimized code being generated but I am quite disappointed that fpc (checked win64 with -O3 and -O4) does not use cmovxx instructions and alike for the most basic things

Re: [fpc-devel] Producing assembly with less branches?

2020-07-19 Thread Marģers . via fpc-devel
- Reply to message - Subject: [fpc-devel] Producing assembly with less branches? From: Stefan Glienke To: > Hi, > not sure if anything significantly changed in trunk compared to 3.2 wrt > to optimized code being generated but I am quite disappointed that fpc > (checked win64 with -O3 a

[fpc-devel] Producing assembly with less branches?

2020-07-19 Thread Stefan Glienke
Hi, not sure if anything significantly changed in trunk compared to 3.2 wrt to optimized code being generated but I am quite disappointed that fpc (checked win64 with -O3 and -O4) does not use cmovxx instructions and alike for the most basic things and produces terrible code like this: unit1

[fpc-devel] Peephole Optimizer suggestions

2020-07-19 Thread J. Gareth Moreton
Hi everyone, Now that I'm back in my element and looking for improvements in the generated assembly language, I'm pondering about refactoring something in the Peephole Optimizer when it comes to removing instrucitons. During the development of the optimisations over at #37389, I was struggli

Re: [fpc-devel] Binary size discrepancy with -a

2020-07-19 Thread J. Gareth Moreton
And uploaded the new peephole optimisations. #37389 and #37390. On 19/07/2020 14:20, J. Gareth Moreton wrote: I'm sure I'll have a look at it at some point!  Maybe later though.  At the moment I'm getting ready to submt a couple of new peephole optimisations, with some future extensions to th

Re: [fpc-devel] Binary size discrepancy with -a

2020-07-19 Thread J. Gareth Moreton
I'm sure I'll have a look at it at some point!  Maybe later though.  At the moment I'm getting ready to submt a couple of new peephole optimisations, with some future extensions to them down the line - I'm just waiting for the regression tests to finish. Gareth aka. Kit On 19/07/2020 13:54, S

Re: [fpc-devel] Binary size discrepancy with -a

2020-07-19 Thread Florian Klämpfl
Am 19.07.20 um 14:54 schrieb Sven Barth via fpc-devel: J. Gareth Moreton > schrieb am So., 19. Juli 2020, 11:20: Ah, of course!  It's still a remarkable difference though and I wonder if the internal assembler could use an update in that case. Feel free

Re: [fpc-devel] Binary size discrepancy with -a

2020-07-19 Thread Sven Barth via fpc-devel
J. Gareth Moreton schrieb am So., 19. Juli 2020, 11:20: > Ah, of course! It's still a remarkable difference though and I wonder if > the internal assembler could use an update in that case. > Feel free to find out where the difference comes from. ;) Regards, Sven >

Re: [fpc-devel] Binary size discrepancy with -a

2020-07-19 Thread J. Gareth Moreton
Ah, of course!  It's still a remarkable difference though and I wonder if the internal assembler could use an update in that case. Gareth aka. Kit On 19/07/2020 08:20, Sven Barth via fpc-devel wrote: J. Gareth Moreton > schrieb am So., 19. Juli 2020, 05:09:

Re: [fpc-devel] Binary size discrepancy with -a

2020-07-19 Thread Sven Barth via fpc-devel
J. Gareth Moreton schrieb am So., 19. Juli 2020, 05:09: > Hi everyone, > > I've noticed something a bit weird with the Free Pascal Compiler when > you use the the -a option to dump the compiled assembly files... the > resultant binaries are sometimes smaller. I recently tried it with > Lazarus u