Re: [fpc-devel] Bitset assembler

2016-09-11 Thread Jonas Maebe
On 11/09/16 15:11, Jeppe Johansen wrote: Here's an ARM version that runs in 5 cycles on a Cortex A8: movr2,r1,lsr #5 movr12,#1 ldrr3,[r0, r2, lsl #2]! orrr2,r3,r12,lsl r1 strr2,[r0] andr0,r12,r3,lsr r1 It's one cycle faster than what the compiler

Re: [fpc-devel] Bitset assembler

2016-09-11 Thread Jeppe Johansen
On 09/08/2016 11:02 AM, Jy V wrote: Hello to all assembler experts, I would greatly appreciate if some people could help me prepare some asm code for FreePascal for Win32, Win64, Linux x86, Linux x64 (and maybe some ARM32bit + AARCH64) I am using Lazarus 1.6, FPC 3.0.0 SVN revision 51630

Re: [fpc-devel] Bitset assembler

2016-09-11 Thread Jy V
Thank you Thomas, I will experiment with {$ASMMODE INTEL} On Sunday, September 11, 2016, Tomas Hajny wrote: > On Sun, September 11, 2016 09:43, Jy V wrote: >> Thank you Jonas, >> so back to my original question, >> is there an asm expert out there who knows if the syntax is

Re: [fpc-devel] Bitset assembler

2016-09-11 Thread Tomas Hajny
On Sun, September 11, 2016 09:43, Jy V wrote: > Thank you Jonas, > so back to my original question, > is there an asm expert out there who knows if the syntax is invalid, or > simply the compiler does not implement bt, bts, btr instructions . . In general, GNU assembler syntax requires you to

Re: [fpc-devel] Bitset assembler

2016-09-11 Thread Jy V
Thank you Jonas, so back to my original question, is there an asm expert out there who knows if the syntax is invalid, or simply the compiler does not implement bt, bts, btr instructions function BitsetGet(const Bits; Index: UInt32): Boolean; assembler; asm {$IFDEF WIN64} // Win64 IN: rcx =

Re: [fpc-devel] Bitset assembler

2016-09-10 Thread Jonas Maebe
On 10/09/16 12:55, Jy V wrote: I am not sure the FreePascal compiler is able to convert the code of the procedure BitsetSet(var Bits; Index: UInt32); PUInt64Array(@Bits)^[Index shr 6] := PUInt64Array(@Bits)^[Index shr 6] or (Int64(1) shl (Index and 63)); into a single instruction: bts

Re: [fpc-devel] Bitset assembler

2016-09-10 Thread Jy V
On Fri, Sep 9, 2016 at 11:00 AM, Thaddy de Koning wrote: > With the proper optimizations it will probably hard to improve on. > Compile the code with -O4 and -s. That generates the assembler output in a > *.s file. > The compiler is rather good at bitmaniputations. > I am

Re: [fpc-devel] Bitset assembler

2016-09-10 Thread Thaddy de Koning
Before I answer that: did you check what assembler code the compiler generates? That may be just as efficient as handcoded assembly in this case. With the proper optimizations it will probably hard to improve on. Compile the code with -O4 and -s. That generates the assembler output in a *.s file.

Re: [fpc-devel] Bitset assembler

2016-09-09 Thread Michael Schnell
Just a note: Such functions often are needed for semaphores etc. In that case they need to take multi-thread and multi-Processor issues into account. -Michael ___ fpc-devel maillist - fpc-devel@lists.freepascal.org

[fpc-devel] Bitset assembler

2016-09-08 Thread Jy V
Hello to all assembler experts, I would greatly appreciate if some people could help me prepare some asm code for FreePascal for Win32, Win64, Linux x86, Linux x64 (and maybe some ARM32bit + AARCH64) I am using Lazarus 1.6, FPC 3.0.0 SVN revision 51630 x86_64-win64-win32/win64 function