Re: [fpc-devel] What's the status of Maciej's Smart Pointer enhancements?

2018-04-29 Thread Sven Barth via fpc-devel
Anthony Walter schrieb am So., 29. Apr. 2018, 21:27: > I've run into an almost must have use case for FPC smart pointers as > described and implemented by Maciej. I wanted to know from the people who > make decision about what to merge, what's the status of rolling his >

Re: [fpc-devel] *** GMX Spamverdacht *** Re: Broken frac function in FPC3.1.1 / Windows x86_64

2018-04-29 Thread Thorsten Engler
> -Original Message- > From: fpc-devel On Behalf > Of Florian Klaempfl > Sent: Monday, 30 April 2018 04:28 > > That ended up making things worse in some cases. > > Can you take a look at the generated machine code if delphi uses > proper multi

Re: [fpc-devel] Broken frac functionin FPC3.1.1 / Windows x86_64

2018-04-29 Thread J. Gareth Moreton
Hi Florian.  Thorsten and I got down to a fairly optimised version of Frac, in both speed and size: function Frac(const X: ValReal): ValReal; assembler; nostackframe; asm   movq  rax,  xmm0   shr   rax,  48   and   ax,   $7FF0   cmp   ax,   $4330   jge   @@zero

[fpc-devel] What's the status of Maciej's Smart Pointer enhancements?

2018-04-29 Thread Anthony Walter
Here is a video overview of this message I've run into an almost must have use case for FPC smart pointers as described and implemented by Maciej. I wanted to know from the people who make decision about what to merge, what's the status of

Re: [fpc-devel] *** GMX Spamverdacht *** Re: Broken frac function in FPC3.1.1 / Windows x86_64

2018-04-29 Thread Florian Klaempfl
Am 28.04.2018 um 17:57 schrieb Thorsten Engler: >> -Original Message- >> From: fpc-devel On Behalf >> Of Florian Klämpfl >> So something like >> >> cmp edx, $4330 >> jge @@zero >> cmp edx, $3FE0 >> .align 16 >>

Re: [fpc-devel] Broken frac functioninFPC3.1.1 / Windows x86_64

2018-04-29 Thread J. Gareth Moreton
I stand corrected. Normally if I want to write a second epilogue, I simply compile the project and look at the disassembly, and copy what the compiler puts in for the epilogue.  The only one I remember off-hand is for leaf functions with no stack frame and which uses only volatile registers,

Re: [fpc-devel] *** GMX Spamverdacht *** Re: Broken frac functionin FPC3.1.1 / Windows x86_64

2018-04-29 Thread Thorsten Engler
> From: fpc-devel On Behalf > Of J. Gareth Moreton > For functions with a stack frame, either LEAVE or MOV RSP, RBP; POP > RBP must precede it. It's not quite that simple, at least under windows: https://docs.microsoft.com/en-us/cpp/build/prolog-and-epilog

Re: [fpc-devel] Broken frac functionin FPC3.1.1 / Windows x86_64

2018-04-29 Thread J. Gareth Moreton
That's great to hear! Glad to help. For functions with no stack frame, the compiler simply puts RET at the very end of the routine and is all that's needed. For functions with a stack frame, either LEAVE or MOV RSP, RBP; POP RBP must precede it. The optional parameter after RET is the

Re: [fpc-devel] *** GMX Spamverdacht *** Re: Broken frac function in FPC3.1.1 / Windows x86_64

2018-04-29 Thread Thorsten Engler
> From: fpc-devel On Behalf Of J. > Gareth Moreton > Sent: Sunday, 29 April 2018 12:36 > As an extra point, removing the 'skip' check (i.e. cmp ax, $3FE0, jbe @@skip) > removes 6 bytes from the code size and shaves about 2 to 3 nanoseconds off > the