Subject: Re: CVS commit: src/sys/netipsec
To: M. Warner Losh <imp@bsdimp.com>
From: David Laight <david@l8s.co.uk>
List: source-changes
Date: 08/14/2003 08:57:16
> Arguing that gcc does a nice job would likely be met with skepticism,
> especially in the absense of good, hard numbers for various data sizes
> on various CPUs.  FreeBSD has a fairly well optimized bcopy for
> different cpus.  There is also a long history of distrust of gcc's
> ability to inline memcpy in a non-lame way.  You can search the
> archvies for a number of instances where hand written memcpy or bcopy
> routines did much better than gcc.

Indeed, on a modern x86 you do not want (ever) to execute movs{b,w,l}
unless it is repeated AND the repeat count is considerable
(unless you are optimising for space).

ISTR that something like:
1:	mov	(%esi,%ecx,4),%eax
	mov	%eax,(%edi,%ecx,4)
	dec	%ecx
	jnc	1b
is faster than 'rep movsw' for %ecx < (about) 16.

	David

-- 
David Laight: david@l8s.co.uk