-
-
Notifications
You must be signed in to change notification settings - Fork 23
Provide more atomic ops #48
Copy link
Copy link
Closed
Labels
C-enhancementCategory: A new feature or an improvement for an existing oneCategory: A new feature or an improvement for an existing one
Description
The following are the atomic operations supported by the x86 lock prefix.
ADD, ADC, AND, BTC, BTR, BTS, CMPXCHG, CMPXCH8B, CMPXCHG16B, DEC, INC, NEG, NOT, OR, SBB, SUB, XOR, XADD, and XCHG.
We currently do not provide corresponding operations for BTC, BTR, BTS, NEG, and NOT. 1 2
NEG and NOT don't return the previous value, but can be provided in a way like #47.
- BTS (fetch_bit_set?); done in Add bit_{set,clear,toggle} to Atomic{I,U}* and AtomicPtr #72
- BTR (fetch_bit_reset or fetch_bit_clear?); done in Add bit_{set,clear,toggle} to Atomic{I,U}* and AtomicPtr #72
- BTC (fetch_bit_toggle?); done in Add bit_{set,clear,toggle} to Atomic{I,U}* and AtomicPtr #72
- NEG (fetch_neg, neg); done in Add fetch_neg/neg/fetch_not/not #54
- NOT (fetch_not, not); done in Add fetch_neg/neg/fetch_not/not #54
Footnotes
-
To be exact, BTC, BTR, and BTS are available via other operations on Rust 1.65+, but
LLVM only generatesEDIT: see https://github.com/taiki-e/portable-atomic/issues/48#issuecomment-1453473831 ↩lock bt{s,r,c}for immediate bit offsets (as of LLVM 15). -
As for NOT, an equivalent is available via
fetch_xor(-1i*)/fetch_xor(u*::MAX), though, LLVM does not lower it tolock not. ↩
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-enhancementCategory: A new feature or an improvement for an existing oneCategory: A new feature or an improvement for an existing one