Skip to content

Commit 8813362

Browse files
committed
Cleanups for AVR/MSP430/PowerPC/RISC-V/s390x
1 parent 6d945ab commit 8813362

File tree

16 files changed

+773
-464
lines changed

16 files changed

+773
-464
lines changed

.github/.cspell/project-dictionary.txt

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ cmovge
2626
cmovl
2727
cmpd
2828
cmpld
29+
cmpw
2930
cmpxchg
3031
cpsid
3132
cpsie
@@ -108,6 +109,7 @@ movq
108109
mpidr
109110
mspdebug
110111
mstatus
112+
mstatush
111113
mvfr
112114
negs
113115
neoverse
@@ -123,6 +125,7 @@ pointee
123125
prctl
124126
prefetcher
125127
PRIMASK
128+
pstq
126129
quadword
127130
RAII
128131
rcpc

DEVELOPMENT.md

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ portable-atomic/
1818
│ ├── imp/
1919
│ │ ├── atomic128/ -- 128-bit atomic implementations on 64-bit architectures (mainly by asm)
2020
│ │ ├── atomic64/ -- 64-bit atomic implementations on 32-bit architectures (mainly by asm)
21+
│ │ ├── avr.rs -- atomic implementation for AVR (by asm)
2122
│ │ ├── core_atomic.rs -- wrapper for core::sync::atomic types
2223
│ │ ├── detect/ -- Run-time CPU feature detection implementations used for outline-atomics
2324
│ │ ├── fallback/ -- fallback implementation based on global locks

build.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -377,27 +377,27 @@ fn main() {
377377
if !version.probe(83, 2024, 9, 27) || needs_target_feature_fallback(&version, None) {
378378
let target_endian =
379379
env::var("CARGO_CFG_TARGET_ENDIAN").expect("CARGO_CFG_TARGET_ENDIAN not set");
380-
// powerpc64le is pwr8+ by default https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/PowerPC/PPC.td#L702
380+
// powerpc64le is pwr8 by default https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/PowerPC/PPC.td#L702
381381
// See also https://github.com/rust-lang/rust/issues/59932
382-
let mut has_pwr8_features = target_endian == "little";
383-
// https://github.com/llvm/llvm-project/commit/549e118e93c666914a1045fde38a2cac33e1e445
382+
let mut pwr8_features = target_endian == "little";
384383
if let Some(cpu) = &target_cpu() {
385384
if let Some(mut cpu_version) = strip_prefix(cpu, "pwr") {
386385
cpu_version = strip_suffix(cpu_version, "x").unwrap_or(cpu_version); // for pwr5x and pwr6x
387386
if let Ok(cpu_version) = cpu_version.parse::<u32>() {
388-
has_pwr8_features = cpu_version >= 8;
387+
pwr8_features = cpu_version >= 8;
389388
}
390389
} else {
391390
// https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/PowerPC/PPC.td#L702
392391
// https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/PowerPC/PPC.td#L483
393392
// On the minimum external LLVM version of the oldest rustc version which we can use asm_experimental_arch
394393
// on this target (see CI config for more), "future" is based on pwr10 features.
395394
// https://github.com/llvm/llvm-project/blob/llvmorg-12.0.0/llvm/lib/Target/PowerPC/PPC.td#L370
396-
has_pwr8_features = cpu == "ppc64le" || cpu == "future";
395+
pwr8_features = cpu == "future" || cpu == "ppc64le";
397396
}
398397
}
398+
// power8 features: https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/PowerPC/PPC.td#L409
399399
// lqarx and stqcx.
400-
target_feature_fallback("quadword-atomics", has_pwr8_features);
400+
target_feature_fallback("quadword-atomics", pwr8_features);
401401
}
402402
}
403403
"s390x" => {
@@ -421,12 +421,14 @@ fn main() {
421421
}
422422
// As of rustc 1.80, target_feature "fast-serialization"/"load-store-on-cond"/"distinct-ops"/"miscellaneous-extensions-3" is not available on rustc side:
423423
// https://github.com/rust-lang/rust/blob/1.80.0/compiler/rustc_target/src/target_features.rs
424+
// arch9 features: https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/SystemZ/SystemZFeatures.td#L103
424425
// bcr 14,0
425426
target_feature_fallback("fast-serialization", arch9_features);
426427
// {l,st}oc{,g}{,r}
427428
target_feature_fallback("load-store-on-cond", arch9_features);
428429
// {al,sl,n,o,x}{,g}rk
429430
target_feature_fallback("distinct-ops", arch9_features);
431+
// arch13 features: https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/SystemZ/SystemZFeatures.td#L301
430432
// nand (nnr{,g}k), select (sel{,g}r), etc.
431433
target_feature_fallback("miscellaneous-extensions-3", arch13_features);
432434
}

0 commit comments

Comments
 (0)