HomeFreeBSD

lib/libc/amd64/string/memcmp.S: add baseline implementation

Description

lib/libc/amd64/string/memcmp.S: add baseline implementation

This changeset adds a baseline implementation of memcmp and bcmp
for amd64. The same code is used for both functions with conditional
code were the behaviour differs (we need more precise output for the
memcmp case).

FreeBSD documents that memcmp returns the difference between the
mismatching characters. Slightly faster code would be possible could
we relax this requirement to the ISO/IEC 9899:1999 requirement of
merely returning a negative/positive integer or zero.

Performance is better than bionic and glibc, except for long strings
were the two are 13% faster. This could be because they use SSE4
ptest which we cannot use in a baseline kernel.

Sponsored by: The FreeBSD Foundation
Approved by: mjg
Differential Revision: https://reviews.freebsd.org/D41442

Details

Provenance
fuzAuthored on Jul 12 2023, 1:35 PM
Differential Revision
D41442: lib/libc/amd64/string: add baseline implementation of memcmp, bcmp
Parents
rG245fee96c0a5: share/man/man7/simd.7: document SIMD-enhanced stpcpy()
Branches
Unknown
Tags
Unknown