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)
Fri, May 17, 10:42 PM
Unknown Object (File)
Fri, May 17, 2:40 AM
Unknown Object (File)
Mar 19 2024, 3:47 PM
Unknown Object (File)
Mar 19 2024, 3:23 PM
Unknown Object (File)
Jan 14 2024, 8:02 AM
Unknown Object (File)
Dec 22 2023, 11:37 PM
Unknown Object (File)
Dec 10 2023, 4:49 PM
Unknown Object (File)
Oct 22 2023, 3:42 AM
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.