Re: Benchmark memchar (with GCC builtins)

2015-11-03 Thread Andrei Alexandrescu via Digitalmars-d
On 11/02/2015 09:33 PM, Iakh wrote: - Naive:21.46 TickDuration(132842482) SIMD: 1.161 TickDuration(7188211) (was)SIMD: 3.04 TickDuration(18920182) C:1 TickDuration(6189222) Looks like the current memchr is well optimized. Not much blood

Re: Benchmark memchar (with GCC builtins)

2015-11-02 Thread Iakh via Digitalmars-d
On Friday, 30 October 2015 at 21:33:25 UTC, Andrei Alexandrescu wrote: Could you please take a look at GCC's generated code and implementation of memchr? -- Andrei So i did. I rewrite code to do main work in cacheLineSize chunks. And this is what GLIBC version do. So main loop looks this:

Re: Benchmark memchar (with GCC builtins)

2015-10-31 Thread rsw0x via Digitalmars-d
On Friday, 30 October 2015 at 21:29:47 UTC, Iakh wrote: ... I got it to 1.5 the running time of C using SSE2 but couldn't get GDC to emit the correct aligned loads, if I used __builtin_assume_aligned the optimizer started being really off.

Re: Benchmark memchar (with GCC builtins)

2015-10-31 Thread Dmitry Olshansky via Digitalmars-d
On 31-Oct-2015 00:29, Iakh wrote: I continue to play with SIMD. So I was trying to use std.simd But it has lots of thing to be implemented. And I also gave up with core.simd.__simd due to problems with PMOVMSKB instruction (it is not implemented). Today I was playing with memchr for gdc:

Re: Benchmark memchar (with GCC builtins)

2015-10-31 Thread Iakh via Digitalmars-d
On Saturday, 31 October 2015 at 08:37:23 UTC, rsw0x wrote: I got it to 1.5 the running time of C using SSE2 but couldn't Can you share your solution?

Re: Benchmark memchar (with GCC builtins)

2015-10-31 Thread Iakh via Digitalmars-d
On Friday, 30 October 2015 at 21:33:25 UTC, Andrei Alexandrescu wrote: Could you please take a look at GCC's generated code and implementation of memchr? -- Andrei Copy-and-paste from glibc's memchr(runGLibC) gaves the result below. - Naive: 21.4 TickDuration(132485705) SIMD:

Benchmark memchar (with GCC builtins)

2015-10-30 Thread Iakh via Digitalmars-d
I continue to play with SIMD. So I was trying to use std.simd But it has lots of thing to be implemented. And I also gave up with core.simd.__simd due to problems with PMOVMSKB instruction (it is not implemented). Today I was playing with memchr for gdc: memchr:

Re: Benchmark memchar (with GCC builtins)

2015-10-30 Thread Iakh via Digitalmars-d
On Friday, 30 October 2015 at 21:33:25 UTC, Andrei Alexandrescu wrote: Could you please take a look at GCC's generated code and implementation of memchr? -- Andrei glibc uses something like pseudo-SIMD with ordinal x86 instructions (XOR magic, etc). Deap comarison I left for next time :)

Re: Benchmark memchar (with GCC builtins)

2015-10-30 Thread Andrei Alexandrescu via Digitalmars-d
On 10/30/2015 05:29 PM, Iakh wrote: I continue to play with SIMD. So I was trying to use std.simd But it has lots of thing to be implemented. And I also gave up with core.simd.__simd due to problems with PMOVMSKB instruction (it is not implemented). Today I was playing with memchr for gdc:

Re: Benchmark memchar (with GCC builtins)

2015-10-30 Thread Marco Leise via Digitalmars-d
Am Fri, 30 Oct 2015 22:31:54 + schrieb Iakh : > On Friday, 30 October 2015 at 21:33:25 UTC, Andrei Alexandrescu > wrote: > > Could you please take a look at GCC's generated code and > > implementation of memchr? -- Andrei > > glibc uses something like pseudo-SIMD with