Skip to content

Commit 4d94b3c

Browse files
committed
Support Arm64EC
1 parent 91ec716 commit 4d94b3c

File tree

7 files changed

+30
-9
lines changed

7 files changed

+30
-9
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This crate provides a way to soundly perform such operations.
1818

1919
## Platform Support
2020

21-
Currently, x86, x86_64, ARM, AArch64, RISC-V, LoongArch64, MIPS32, MIPS64, PowerPC, s390x, MSP430, AVR, and Hexagon are supported.
21+
Currently, x86, x86_64, ARM, AArch64, RISC-V, LoongArch64, MIPS32, MIPS64, PowerPC, s390x, MSP430, Arm64EC, AVR, and Hexagon are supported.
2222

2323
| target_arch | primitives | load/store | swap/CAS |
2424
| -------------------------------- | --------------------------------------------------- |:----------:|:--------:|
@@ -38,6 +38,7 @@ Currently, x86, x86_64, ARM, AArch64, RISC-V, LoongArch64, MIPS32, MIPS64, Power
3838
| powerpc64 (pwr8+) \[4] \[6] | i128,u128 |||
3939
| s390x \[4] | isize,usize,i8,u8,i16,u16,i32,u32,i64,u64,i128,u128 |||
4040
| msp430 \[4] | isize,usize,i8,u8,i16,u16 || |
41+
| arm64ec \[4] (experimental) | isize,usize,i8,u8,i16,u16,i32,u32,i64,u64,i128,u128 |||
4142
| avr \[4] (experimental) | isize,usize,i8,u8,i16,u16 |||
4243
| hexagon \[4] (experimental) | isize,usize,i8,u8,i16,u16,i32,u32,i64,u64 |||
4344

build.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ fn main() {
6262
println!("cargo:rustc-cfg=atomic_maybe_uninit_no_loongarch64_asm");
6363
}
6464
}
65-
"avr" | "hexagon" | "mips" | "mips32r6" | "mips64" | "mips64r6" | "msp430" | "powerpc"
66-
| "powerpc64" => {
65+
"arm64ec" | "avr" | "hexagon" | "mips" | "mips32r6" | "mips64" | "mips64r6" | "msp430"
66+
| "powerpc" | "powerpc64" => {
6767
if version.nightly && is_allowed_feature("asm_experimental_arch") {
6868
println!("cargo:rustc-cfg=atomic_maybe_uninit_unstable_asm_experimental_arch");
6969
}
@@ -103,7 +103,7 @@ fn main() {
103103
// cmpxchg16b_target_feature stabilized in Rust 1.69.
104104
target_feature_if("cmpxchg16b", has_cmpxchg16b, &version, Stable(69));
105105
}
106-
"aarch64" => {
106+
"aarch64" | "arm64ec" => {
107107
// AArch64 macOS always supports FEAT_LSE/FEAT_LSE2/FEAT_LRCPC because it is ARMv8.5-A:
108108
// https://github.com/llvm/llvm-project/blob/llvmorg-18.1.2/llvm/include/llvm/TargetParser/AArch64TargetParser.h#L728
109109
let mut has_lse = is_macos;

src/arch/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
target_arch = "loongarch64",
2828
all(
2929
any(
30+
target_arch = "arm64ec",
3031
target_arch = "avr",
3132
target_arch = "hexagon",
3233
target_arch = "mips",
@@ -44,7 +45,10 @@
4445
#[path = "cfgs/unsupported.rs"]
4546
mod unsupported;
4647

47-
#[cfg(target_arch = "aarch64")]
48+
#[cfg(any(
49+
target_arch = "aarch64",
50+
all(target_arch = "arm64ec", atomic_maybe_uninit_unstable_asm_experimental_arch),
51+
))]
4852
mod aarch64;
4953
#[cfg(target_arch = "arm")]
5054
#[cfg(all(

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This crate provides a way to soundly perform such operations.
1212
1313
## Platform Support
1414
15-
Currently, x86, x86_64, ARM, AArch64, RISC-V, LoongArch64, MIPS32, MIPS64, PowerPC, s390x, MSP430, AVR, and Hexagon are supported.
15+
Currently, x86, x86_64, ARM, AArch64, RISC-V, LoongArch64, MIPS32, MIPS64, PowerPC, s390x, MSP430, Arm64EC, AVR, and Hexagon are supported.
1616
1717
| target_arch | primitives | load/store | swap/CAS |
1818
| -------------------------------- | --------------------------------------------------- |:----------:|:--------:|
@@ -32,6 +32,7 @@ Currently, x86, x86_64, ARM, AArch64, RISC-V, LoongArch64, MIPS32, MIPS64, Power
3232
| powerpc64 (pwr8+) \[4] \[6] | i128,u128 | ✓ | ✓ |
3333
| s390x \[4] | isize,usize,i8,u8,i16,u16,i32,u32,i64,u64,i128,u128 | ✓ | ✓ |
3434
| msp430 \[4] | isize,usize,i8,u8,i16,u16 | ✓ | |
35+
| arm64ec \[4] (experimental) | isize,usize,i8,u8,i16,u16,i32,u32,i64,u64,i128,u128 | ✓ | ✓ |
3536
| avr \[4] (experimental) | isize,usize,i8,u8,i16,u16 | ✓ | ✓ |
3637
| hexagon \[4] (experimental) | isize,usize,i8,u8,i16,u16,i32,u32,i64,u64 | ✓ | ✓ |
3738

src/tests/helper.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ macro_rules! __test_atomic {
152152
#[allow(clippy::ptr_as_ptr)]
153153
if core::mem::size_of::<$int_type>() <= core::mem::size_of::<usize>()
154154
|| cfg!(all(
155-
target_arch = "aarch64",
155+
any(target_arch = "aarch64", target_arch = "arm64ec"),
156156
any(target_feature = "lse2", atomic_maybe_uninit_target_feature = "lse2"),
157157
))
158158
|| cfg!(all(

src/utils.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ zero_extend!(i32, u32, i64, u64, isize, usize);
170170
#[allow(dead_code)]
171171
#[cfg(any(
172172
target_arch = "aarch64",
173+
target_arch = "arm64ec",
173174
target_arch = "powerpc64",
174175
target_arch = "s390x",
175176
target_arch = "x86_64",
@@ -203,11 +204,21 @@ pub(crate) union MaybeUninit64 {
203204
#[repr(C)]
204205
pub(crate) struct Pair<T: Copy> {
205206
// little endian order
206-
#[cfg(any(target_endian = "little", target_arch = "aarch64", target_arch = "arm"))]
207+
#[cfg(any(
208+
target_endian = "little",
209+
target_arch = "aarch64",
210+
target_arch = "arm64ec",
211+
target_arch = "arm",
212+
))]
207213
pub(crate) lo: MaybeUninit<T>,
208214
pub(crate) hi: MaybeUninit<T>,
209215
// big endian order
210-
#[cfg(not(any(target_endian = "little", target_arch = "aarch64", target_arch = "arm")))]
216+
#[cfg(not(any(
217+
target_endian = "little",
218+
target_arch = "aarch64",
219+
target_arch = "arm64ec",
220+
target_arch = "arm",
221+
)))]
211222
pub(crate) lo: MaybeUninit<T>,
212223
}
213224

tools/build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ default_targets=(
120120
# rustc --print target-list | grep -E '^msp430'
121121
msp430-none-elf
122122

123+
# arm64ec
124+
# rustc --print target-list | grep -E '^arm64ec'
125+
arm64ec-pc-windows-msvc
126+
123127
# avr
124128
# rustc --print target-list | grep -E '^avr'
125129
avr-unknown-gnu-atmega2560 # custom target

0 commit comments

Comments
 (0)