Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2017-09

x86-64 optimizations

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

J. Gareth Moreton

Hi everyone,

Following on from an enhancement report I posted a few months ago, I decided to take a shot at learning the nuances of the compiler's source code and programming in the improvements myself. These don't fix any bugs per se, but aim to reduce the code size of compiled x86-64 binaries without sacrificing speed.

The report in question, and the patch, can be found over here: https://bugs.freepascal.org/view.php?id=32037

I'll be interested to hear if it works and can possibly be implemented. This is my first code contribution to the project, so I hope I didn't do too badly!

Yours faithfully,

J. Gareth "Kit" Moreton

Reply by email

Florian Klämpfl
to J. Gareth Moreton
J. Gareth Moreton wrote 10 lines
Hi everyone, Following on from an enhancement report I posted a few months ago, I decided to take a shot at learning the nuances of the compiler's source code and programming in the improvements myself. These don't fix any bugs per se, but aim to reduce the code size of compiled x86-64 binaries without sacrificing speed. The report in question, and the patch, can be found over here: https://bugs.freepascal.org/view.php?id=32037 I'll be interested to hear if it works and can possibly be implemented. This is my first code contribution to the project, so I hope I didn't do too badly!

No, it looks good at a first glance. I will try to integrate it the next days into the official sources, so let's see if something pops up, if yes, I'll come back :)

Thank you for your work so far!

Show quoted text 8 lines
Yours faithfully, J. Gareth "Kit" Moreton _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

J. Gareth Moreton

Thank you Anthony,

Admittedly I was a little nervous, wondering if you guys might think "what's this squirt doing submitting something that isn't even a bug?!"

Good to know that it looks reasonable. I did do a full build of FPC and Lazarus with it to ensure it actually compiled and ran (Lazarus appeared to work without any problems), and also did a compilation of a test project that printed the output of a function that set a 64-bit result (to ensure a 64-bit register was used).

It's not perfect though because there are some minor hacks in the assembler instruction list in order to get the compiler to look out for 32-bit signed opcodes. A cleaner solution would be to revert the changes to the assembler list, but fix the compiler's handling of signed operands, since I think it only handles signed bytes currently (which is understandable, as signed 32-bit immediates only first appeared with x86-64 extensions).

Thanks once again - I hope it actually works and gets merged. Call it a source of personal pride if it does!

Gareth

On Tue 26/09/17 13:47 , Anthony Walter sent:

Show quoted text 16 lines
J, Thanks for the contribution. I looked over your patch and seems reasonable, though I didn't try building fpc with it. We need more  people like you helping to improve the compiler. Thanks! _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel [1] Links: ------ [1] http://secureweb.fast.net.uk/parse.php?redirect=http://lists.freepascal.org /cgi-bin/mailman/listinfo/fpc-devel

Reply by email

J. Gareth Moreton

Thank you Florian. I use Lazarus a lot for my own projects, so it's only fair that I give something back, and since I've gotten to grips with x86-64 assembly language, that seems like a good place to start.

Fingers crossed!

Gareth

On Mon 25/09/17 21:37 , Florian Klämpfl sent:

Show quoted text 58 lines
Am 24.09.2017 um 14:20 schrieb J. Gareth Moreton: > Hi everyone, > > Following on from an enhancement report I posted a few months ago, I decided to take a shot at learning the > nuances of the compiler's source code and programming in the improvements myself. These don't fix any bugs per > se, but aim to reduce the code size of compiled x86-64 binaries without sacrificing speed. > > The report in question, and the patch, can be found over here: https://bugs.freepascal.org/view.php?id=32037 > > I'll be interested to hear if it works and can possibly be implemented. This is my first code contribution to > the project, so I hope I didn't do too badly! No, it looks good at a first glance. I will try to integrate it the next days into the official sources, so let's see if something pops up, if yes, I'll come back :) Thank you for your work so far! > > Yours faithfully, > > J. Gareth "Kit" Moreton > _______________________________________________ > fpc-devel maillist - > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel > _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email