[PATCH] eal/x86: optimize memcpy of small 64-byte blocks

Morten Brørup mb at smartsharesystems.com
Tue Aug 4 18:25:42 CEST 2026


> From: Stephen Hemminger [mailto:stephen at networkplumber.org]
> Sent: Tuesday, 4 August 2026 17.52
> 
> On Tue,  4 Aug 2026 14:33:04 +0000
> Morten Brørup <mb at smartsharesystems.com> wrote:
> 
> > +	/* Common way for small copy size of 64-byte blocks. Unlikely, so
> constant size only */
> > +	if (__rte_constant(n) && (n & 63) == 0 && n <=
> RTE_MEMCPY_BLOCK_64_MAX) {
> > +		void *ret = dst;
> > +
> 
> Maybe just let compiler decide, it will generate vector instructions in
> most cases.
> 
> 	if (__rte_constant(n))
> 		return mempcpy(dst, src, n);

Maybe in most, but not in all:
https://godbolt.org/z/KvdKqT5rY



More information about the dev mailing list