Repository navigation
feat(libc): implement the 16-byte __sync builtins and __atomic_is_lock_free - #6331
Merged
Merged
Conversation
…k_free
__sync_fetch_and_{add,sub,and,or,xor}_16 and __sync_lock_test_and_set_16 are
cmpxchg16b loops returning the previous value, and __atomic_is_lock_free
answers by size and alignment, as in the libc.prx bundled with PPSA08427. Its
generic __atomic_load/store/exchange/compare_exchange are a ud2, so they throw.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q8tinbP1MUpUaDsbNWnGnu
Progress report (b3f9f89 → 6d2708a)📈 System libraries: 88.75% (+0.04%, +11 implemented functions) ✅ 11 implemented
|
This was referenced Oct 15, 2026
Closed
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
11 tasks done
This was referenced Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Implements the libatomic-style exports of the system
libc.prxthat AnyPS5 did not have, in a newsrc/AtomicBuiltins.cpp:__sync_fetch_and_add_16,__sync_fetch_and_sub_16,__sync_fetch_and_and_16,__sync_fetch_and_or_16,__sync_fetch_and_xor_16,__sync_lock_test_and_set_16: alock cmpxchg16bloop returning the previous value, as on the console (GNU inline asm, so no-mcx16/libatomic is needed on either host)__atomic_is_lock_free(size, ptr): sizes 0 and 1 are lock-free, 2/4/8/16 whenptris aligned to the size, anything else is not (the console's jump table)__atomic_load,__atomic_store,__atomic_exchange,__atomic_compare_exchange: in thelibc.prxbundled with PPSA08427 each of these is a singleud2, so a call traps on the console; they throw here, recorded indocs/dev/debt/libc.mdTested
Linux (CachyOS, GCC Release build, plus a clang
-Wall -Wextrasyntax check): newguest_atomic_builtinstest (each operation, the lock-free table, the traps, and two threads racing__sync_fetch_and_add_16across the 64-bit carry) passes.tools/check_conventions.pypasses;tools/pr_overlap.py --branchreports no overlap.Differential test against the console: the PPSA08427
libc.prxwas mapped into a Linux process and__atomic_is_lock_free(sizes 0-39, 64 alignments) and each 16-byte operation (100,000 random operand pairs) were run side by side with this implementation; returned values and memory agree everywhere.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
https://claude.ai/code/session_01Q8tinbP1MUpUaDsbNWnGnu