Commit 45740ac
authored
Rollup merge of rust-lang#97423 - m-ou-se:memory-ordering-intrinsics, r=tmiasko
Simplify memory ordering intrinsics
This changes the names of the atomic intrinsics to always fully include their memory ordering arguments.
```diff
- atomic_cxchg
+ atomic_cxchg_seqcst_seqcst
- atomic_cxchg_acqrel
+ atomic_cxchg_acqrel_release
- atomic_cxchg_acqrel_failrelaxed
+ atomic_cxchg_acqrel_relaxed
// And so on.
```
- `seqcst` is no longer implied
- The failure ordering on chxchg is no longer implied in some cases, but now always explicitly part of the name.
- `release` is no longer shortened to just `rel`. That was especially confusing, since `relaxed` also starts with `rel`.
- `acquire` is no longer shortened to just `acq`, such that the names now all match the `std::sync::atomic::Ordering` variants exactly.
- This now allows for more combinations on the compare exchange operations, such as `atomic_cxchg_acquire_release`, which is necessary for rust-lang#68464.
- This PR only exposes the new possibilities through unstable intrinsics, but not yet through the stable API. That's for [a separate PR](rust-lang#98383) that requires an FCP.
Suffixes for operations with a single memory order:
| Order | Before | After |
|---------|--------------|------------|
| Relaxed | `_relaxed` | `_relaxed` |
| Acquire | `_acq` | `_acquire` |
| Release | `_rel` | `_release` |
| AcqRel | `_acqrel` | `_acqrel` |
| SeqCst | (none) | `_seqcst` |
Suffixes for compare-and-exchange operations with two memory orderings:
| Success | Failure | Before | After |
|---------|---------|--------------------------|--------------------|
| Relaxed | Relaxed | `_relaxed` | `_relaxed_relaxed` |
| Relaxed | Acquire | ❌ | `_relaxed_acquire` |
| Relaxed | SeqCst | ❌ | `_relaxed_seqcst` |
| Acquire | Relaxed | `_acq_failrelaxed` | `_acquire_relaxed` |
| Acquire | Acquire | `_acq` | `_acquire_acquire` |
| Acquire | SeqCst | ❌ | `_acquire_seqcst` |
| Release | Relaxed | `_rel` | `_release_relaxed` |
| Release | Acquire | ❌ | `_release_acquire` |
| Release | SeqCst | ❌ | `_release_seqcst` |
| AcqRel | Relaxed | `_acqrel_failrelaxed` | `_acqrel_relaxed` |
| AcqRel | Acquire | `_acqrel` | `_acqrel_acquire` |
| AcqRel | SeqCst | ❌ | `_acqrel_seqcst` |
| SeqCst | Relaxed | `_failrelaxed` | `_seqcst_relaxed` |
| SeqCst | Acquire | `_failacq` | `_seqcst_acquire` |
| SeqCst | SeqCst | (none) | `_seqcst_seqcst` |File tree
11 files changed
+695
-375
lines changed- compiler
- rustc_codegen_ssa/src
- mir
- rustc_error_codes/src/error_codes
- library/core/src
- sync
- src/test
- run-make-fulldeps/atomic-lock-free
- ui/intrinsics
- auxiliary
11 files changed
+695
-375
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
376 | 376 | | |
377 | 377 | | |
378 | 378 | | |
379 | | - | |
380 | | - | |
| 379 | + | |
| 380 | + | |
381 | 381 | | |
382 | 382 | | |
383 | 383 | | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
405 | 396 | | |
406 | 397 | | |
407 | 398 | | |
| |||
416 | 407 | | |
417 | 408 | | |
418 | 409 | | |
419 | | - | |
| 410 | + | |
420 | 411 | | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
421 | 415 | | |
422 | 416 | | |
423 | | - | |
| 417 | + | |
424 | 418 | | |
425 | 419 | | |
426 | 420 | | |
| |||
432 | 426 | | |
433 | 427 | | |
434 | 428 | | |
435 | | - | |
| 429 | + | |
436 | 430 | | |
437 | 431 | | |
438 | 432 | | |
| |||
460 | 454 | | |
461 | 455 | | |
462 | 456 | | |
463 | | - | |
| 457 | + | |
464 | 458 | | |
465 | 459 | | |
466 | 460 | | |
467 | | - | |
| 461 | + | |
468 | 462 | | |
469 | 463 | | |
470 | 464 | | |
| |||
484 | 478 | | |
485 | 479 | | |
486 | 480 | | |
487 | | - | |
| 481 | + | |
488 | 482 | | |
489 | 483 | | |
490 | 484 | | |
491 | 485 | | |
492 | 486 | | |
493 | 487 | | |
494 | 488 | | |
495 | | - | |
| 489 | + | |
496 | 490 | | |
497 | 491 | | |
498 | 492 | | |
499 | 493 | | |
500 | | - | |
| 494 | + | |
501 | 495 | | |
502 | 496 | | |
503 | 497 | | |
| |||
531 | 525 | | |
532 | 526 | | |
533 | 527 | | |
534 | | - | |
| 528 | + | |
535 | 529 | | |
536 | 530 | | |
537 | 531 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
0 commit comments