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
F102924858: D34673.diff
Mon, Nov 18, 7:45 PM
Unknown Object (File)
Mon, Nov 11, 9:01 AM
Unknown Object (File)
Mon, Nov 11, 8:50 AM
Unknown Object (File)
Mon, Oct 21, 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
Unknown Object (File)
Sep 22 2024, 10:06 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.