Skip to content

Commit

Permalink
Revert "Use asm-based atomic load/store on thumbv6m"
Browse files Browse the repository at this point in the history
This reverts commit a864da7.

rust-lang/rust#99595 has been reverted, so this
is no longer needed.
  • Loading branch information
taiki-e committed Jul 26, 2022
1 parent fc94f2a commit 5a7aa03
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 332 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Portable atomic types including support for 128-bit atomics, atomic float, etc.
- Provide `AtomicI128` and `AtomicU128`.
- Provide `AtomicF32` and `AtomicF64`. (optional)
<!-- - Provide generic `Atomic<T>` type. (optional) -->
- Provide atomic load/store for targets where atomic is not available at all in the standard library. (thumbv6m, riscv without A-extension, msp430, avr)
- Provide atomic load/store for targets where atomic is not available at all in the standard library. (riscv without A-extension, msp430, avr)
- Provide atomic CAS for targets where atomic CAS is not available in the standard library. (thumbv6m, riscv without A-extension, msp430, avr) (optional, [single-core only](#optional-cfg))
- Make features that require newer compilers, such as [fetch_max](https://doc.rust-lang.org/std/sync/atomic/struct.AtomicUsize.html#method.fetch_max), [fetch_min](https://doc.rust-lang.org/std/sync/atomic/struct.AtomicUsize.html#method.fetch_min), [fetch_update](https://doc.rust-lang.org/nightly/std/sync/atomic/struct.AtomicPtr.html#method.fetch_update), and [stronger CAS failure ordering](https://github.com/rust-lang/rust/pull/98383) available on Rust 1.34+.

Expand Down
1 change: 0 additions & 1 deletion no_atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,4 @@ const NO_ATOMIC: &[&str] = &[
"riscv32i-unknown-none-elf",
"riscv32im-unknown-none-elf",
"riscv32imc-unknown-none-elf",
"thumbv6m-none-eabi",
];
288 changes: 0 additions & 288 deletions src/imp/arm.rs

This file was deleted.

4 changes: 2 additions & 2 deletions src/imp/interrupt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
// CAS together with atomic load/store. The load/store will not be
// called while interrupts are disabled, and since the load/store is
// atomic, it is not affected by interrupts even if interrupts are enabled.
#[cfg(portable_atomic_armv6m)]
use super::arm as atomic;
#[cfg(target_arch = "msp430")]
use super::msp430 as atomic;
#[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))]
use super::riscv as atomic;
#[cfg(target_arch = "arm")]
use core::sync::atomic;

#[cfg_attr(portable_atomic_armv6m, path = "armv6m.rs")]
#[cfg_attr(target_arch = "avr", path = "avr.rs")]
Expand Down
18 changes: 0 additions & 18 deletions src/imp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,6 @@ mod s390x;
#[cfg(target_arch = "msp430")]
mod msp430;

#[cfg(any(not(portable_atomic_no_asm), portable_atomic_nightly))]
#[cfg(portable_atomic_armv6m)]
mod arm;
#[cfg(not(any(not(portable_atomic_no_asm), portable_atomic_nightly)))]
#[cfg(portable_atomic_armv6m)]
#[path = "core_atomic.rs"]
mod arm;

#[cfg_attr(portable_atomic_no_cfg_target_has_atomic, cfg(any(test, portable_atomic_no_atomic_cas)))]
#[cfg_attr(
not(portable_atomic_no_cfg_target_has_atomic),
Expand Down Expand Up @@ -132,12 +124,6 @@ mod interrupt;
pub(crate) use self::core_atomic::{
AtomicBool, AtomicI16, AtomicI8, AtomicIsize, AtomicPtr, AtomicU16, AtomicU8, AtomicUsize,
};
// armv6m
#[cfg(not(portable_atomic_unsafe_assume_single_core))]
#[cfg(portable_atomic_armv6m)]
pub(crate) use self::arm::{
AtomicBool, AtomicI16, AtomicI8, AtomicIsize, AtomicPtr, AtomicU16, AtomicU8, AtomicUsize,
};
// msp430
#[cfg(not(portable_atomic_unsafe_assume_single_core))]
#[cfg(target_arch = "msp430")]
Expand Down Expand Up @@ -189,10 +175,6 @@ pub(crate) use self::interrupt::{
))
)]
pub(crate) use self::core_atomic::{AtomicI32, AtomicU32};
// armv6m
#[cfg(not(portable_atomic_unsafe_assume_single_core))]
#[cfg(portable_atomic_armv6m)]
pub(crate) use self::arm::{AtomicI32, AtomicU32};
// riscv32 without A-extension
#[cfg(not(portable_atomic_unsafe_assume_single_core))]
#[cfg(target_arch = "riscv32")]
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Portable atomic types including support for 128-bit atomics, atomic float, etc.
- Provide `AtomicI128` and `AtomicU128`.
- Provide `AtomicF32` and `AtomicF64`. (optional)
<!-- - Provide generic `Atomic<T>` type. (optional) -->
- Provide atomic load/store for targets where atomic is not available at all in the standard library. (thumbv6m, riscv without A-extension, msp430, avr)
- Provide atomic load/store for targets where atomic is not available at all in the standard library. (riscv without A-extension, msp430, avr)
- Provide atomic CAS for targets where atomic CAS is not available in the standard library. (thumbv6m, riscv without A-extension, msp430, avr) (optional, [single-core only](#optional-cfg))
- Make features that require newer compilers, such as [fetch_max](https://doc.rust-lang.org/std/sync/atomic/struct.AtomicUsize.html#method.fetch_max), [fetch_min](https://doc.rust-lang.org/std/sync/atomic/struct.AtomicUsize.html#method.fetch_min), [fetch_update](https://doc.rust-lang.org/nightly/std/sync/atomic/struct.AtomicPtr.html#method.fetch_update), and [stronger CAS failure ordering](https://github.com/rust-lang/rust/pull/98383) available on Rust 1.34+.
Expand Down
18 changes: 0 additions & 18 deletions target-specs/thumbv6m-none-eabi.json

This file was deleted.

4 changes: 1 addition & 3 deletions tools/no_atomic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ file="no_atomic.rs"

no_atomic_cas=()
no_atomic_64=()
no_atomic=(
"thumbv6m-none-eabi" # https://github.com/rust-lang/rust/pull/99595
)
no_atomic=()
for target in $(rustc --print target-list); do
target_spec=$(rustc --print target-spec-json -Z unstable-options --target "${target}")
res=$(jq <<<"${target_spec}" -r 'select(."atomic-cas" == false)')
Expand Down

0 comments on commit 5a7aa03

Please sign in to comment.