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)
Nov 19 2024, 6:53 AM
Unknown Object (File)
Nov 18 2024, 7:45 PM
Unknown Object (File)
Nov 11 2024, 9:01 AM
Unknown Object (File)
Nov 11 2024, 8:50 AM
Unknown Object (File)
Oct 21 2024, 3:39 AM
Unknown Object (File)
Sep 23 2024, 4:49 AM
Unknown Object (File)
Sep 22 2024, 11:33 PM
Unknown Object (File)
Sep 22 2024, 7:47 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.