Re: [fpc-devel] bitshift intrinsics

2016-10-14 Thread Florian Klämpfl
Am 14.10.2016 um 14:25 schrieb Marco van de Voort: > In our previous episode, Jonas Maebe said: >>> If the dword version returned $ it could be at least typecasted to >>> -1. >> >> You can typecast the result to shortint to get -1 in that case. > > That removes the additional branch, reduc

Re: [fpc-devel] bitshift intrinsics

2016-10-14 Thread Marco van de Voort
In our previous episode, Jonas Maebe said: > > If the dword version returned $ it could be at least typecasted to > > -1. > > You can typecast the result to shortint to get -1 in that case. That removes the additional branch, reducing it to a movsbl, so I assume the resulting code is bett

Re: [fpc-devel] bitshift intrinsics

2016-10-14 Thread Jonas Maebe
On 14/10/16 11:44, Marco van de Voort wrote: If the dword version returned $ it could be at least typecasted to -1. You can typecast the result to shortint to get -1 in that case. So the questions are: 1. why do the primitives deliver a signed result ? *unsigned 2. why do they no

[fpc-devel] bitshift intrinsics

2016-10-14 Thread Marco van de Voort
I revisited some old code and noticed there was a BSR using piece of assembler there that used bsr as a cheap 2log for some buffer dimensioning. When I tried to replace it with the intrinsic bsrdword, hoping making it both inlinable and more portablw I noted that the intrinsic was exactly the sam