[PATCH v1] ppc64le: Add optimized __memcmpeq for POWER10

Wilco Dijkstra Wilco.Dijkstra@arm.com
Tue May 26 13:47:04 GMT 2026


Hi Adhemerval,

>> POWER10 has its own because of the numbers in section 2 of the commit message ¡ª Dedicated |__memcmpeq_power10| vs the same selector aliased to |__memcmp_power10|:
>> 
>> |¡Ý 512B : ~9% 16MB ¨C 128MB : ~25% ¨C 32% 256MB : ~3% 1GB : on par|
>> 
>> 16MB¨C128MB is the customer workload range ¡ª that's the band that motivates the dedicated implementation.
>> 
>> Precedent: x86_64 takes the same approach ¡ª |sysdeps/x86_64/multiarch/memcmpeq-{sse2,avx2,evex}.S| are dedicated rather than aliased to |__memcmp_*|.
>Right, I was not expecting that the COMPARE_32 change would yield that much
>difference.

Basically a faster inner loop could also be used for memcmp. There can't be a major
difference between memcmp and __memcmpeq since the difference is in the tail code
(and that will only show up for very small sizes).

Btw are you sure that inner loop is optimal? It has 2 ORRs writing the same
register and thus create an 8 cycle dependency between iterations. I think you
could avoid that by doing a compare every 32 or 64 bytes.

Finally note that compilers do not emit calls to __memcmpeq.

Cheers,
Wilco


More information about the Libc-alpha mailing list