Page MenuHomeFreeBSD

amd64: bring back asm bcmp, code shared with memcmp
ClosedPublic

Authored by mjg on Mar 25 2022, 3:22 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 12, 9:34 PM
Unknown Object (File)
Sun, Oct 12, 3:47 AM
Unknown Object (File)
Sun, Oct 12, 3:47 AM
Unknown Object (File)
Sun, Oct 12, 3:47 AM
Unknown Object (File)
Sat, Oct 11, 5:49 PM
Unknown Object (File)
Sat, Oct 4, 4:11 PM
Unknown Object (File)
Thu, Sep 18, 8:11 AM
Unknown Object (File)
Sep 15 2025, 3:53 PM
Subscribers

Details

Summary

Turns out clang converts "memcmp(foo, bar, len) == 0" and similar to bcmp calls, which makes it worth it to provide the dedicated routine.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

mjg requested review of this revision.Mar 25 2022, 3:22 PM
jhb added a subscriber: jhb.

Do probably want to change the recent change to depends-cleanup.sh to check for bcmp.c instead of bcmp.S (and update the date and git hash).

lib/libc/amd64/string/memcmp.S
150–168

Maybe s/Before we compute it/Before we compute mismatch,/ since the comment is now split up a bit and the antecedent of 'it' may not be as obvious now?

161

This is just the same as 'inc %eax' or 'add $1,%eax'?

I assume the simplification here is that you only need a non-zero value for bcmp() as it doesn't determine a tri-state like memcmp?

This revision is now accepted and ready to land.Mar 25 2022, 6:28 PM
emaste added a subscriber: emaste.

Agree with @jhb wrt the comment

This revision was automatically updated to reflect the committed changes.