mempcpy performance.

Wilco Dijkstra wdijkstr@arm.com
Mon Dec 22 19:38:00 GMT 2014


> Ondřej Bílka wrote:
> Bit off topic,
> 
> I have on my todo list fix that, by on architectures without assembly
> change definition to
> 
> #define mempcpy(dest, src, n) (memcpy (dest, src, n) + n)
> 
> which would remove extra call and possibly allow extra compiler
> optimizations.

This would need to use an extern inline function, but yes that is the right way to do it if there is no assembler implementation. 

A similar thing needs to be done with bcopy and bzero - they currently don't get expanded inline at all due to missing the __asm__ "__bzero" redirection. Interestingly GCC expands __builtin_bzero into memset when inlining is not possible (although it returns the address of bzero if you use it as function symbol). 

Wilco





More information about the Libc-alpha mailing list