Implementing 128-bit atomics in Cranelift
Web page · https://trifectatech.org/blog/implementing-128-bit-atomics-in-cranelift
First seen by Oriel on .
AI summary
The post describes adding AArch64 support for 128-bit atomics in Cranelift so rustc_codegen_cranelift can compile the Rust standard library without patches.
- Because baseline AArch64 lacks single-instruction 128-bit compare-and-swap and read-modify-write operations, the implementation uses exclusive load-store loops rather than relying on LSE or LSE128.
- Sequentially consistent 128-bit loads use an `ldaxp`/`stlxp` loop that retries when the exclusive store fails, matching the ordering strategy shown for LLVM.
- Cranelift’s implementation adds a `LoadAcquire128` instruction, an ISLE lowering rule, and register-allocation handling for two result registers and a scratch register.
- The work also requires implementing instruction encodings for `ldaxp` and `stxp`; the excerpt ends while discussing the `stxp` encoding.
#cranelift #aarch64 #atomics #rust
Generated by gpt-5.6-sol. Check the original for details.
Metric trends
Last 30 days · Up to 120 recorded samples per source and metric, with reposts kept separate · First and latest retained
Points
Score reported by the source.
- Lobsters: 35, latest observation ; +34 over observed period since
Comments
Comment count reported by the source.
- Lobsters: 2, latest observation ; +2 over observed period since
Aliases
| Source | External ID | URL |
|---|---|---|
| Lobsters | 51e1sh | https://trifectatech.org/blog/implementing-128-bit-atomics-in-cranelift/ Read discussion |