Skip to content

Commit 868525b

Browse files
authored
Rollup merge of rust-lang#38959 - Amanieu:atomic128, r=alexcrichton
Add 128-bit atomics This is currently only supported on AArch64 since that is the only target which unconditionally supports 128-bit atomic operations. cc rust-lang#35118
2 parents d497f32 + 9903975 commit 868525b

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

src/libcore/sync/atomic.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,6 +1318,24 @@ atomic_int! {
13181318
unstable(feature = "integer_atomics", issue = "32976"),
13191319
u64 AtomicU64 ATOMIC_U64_INIT
13201320
}
1321+
#[cfg(not(stage0))]
1322+
#[cfg(target_has_atomic = "128")]
1323+
atomic_int! {
1324+
unstable(feature = "i128", issue = "35118"),
1325+
unstable(feature = "i128", issue = "35118"),
1326+
unstable(feature = "i128", issue = "35118"),
1327+
unstable(feature = "i128", issue = "35118"),
1328+
i128 AtomicI128 ATOMIC_I128_INIT
1329+
}
1330+
#[cfg(not(stage0))]
1331+
#[cfg(target_has_atomic = "128")]
1332+
atomic_int! {
1333+
unstable(feature = "i128", issue = "35118"),
1334+
unstable(feature = "i128", issue = "35118"),
1335+
unstable(feature = "i128", issue = "35118"),
1336+
unstable(feature = "i128", issue = "35118"),
1337+
u128 AtomicU128 ATOMIC_U128_INIT
1338+
}
13211339
#[cfg(target_has_atomic = "ptr")]
13221340
atomic_int!{
13231341
stable(feature = "rust1", since = "1.0.0"),

src/test/run-make/atomic-lock-free/atomic_lock_free.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(cfg_target_has_atomic, no_core, intrinsics, lang_items)]
11+
#![feature(cfg_target_has_atomic, no_core, intrinsics, lang_items, i128_type)]
1212
#![crate_type="rlib"]
1313
#![no_core]
1414

@@ -54,6 +54,14 @@ pub unsafe fn atomic_u64(x: *mut u64) {
5454
pub unsafe fn atomic_i64(x: *mut i64) {
5555
atomic_xadd(x, 1);
5656
}
57+
#[cfg(target_has_atomic = "128")]
58+
pub unsafe fn atomic_u128(x: *mut u128) {
59+
atomic_xadd(x, 1);
60+
}
61+
#[cfg(target_has_atomic = "128")]
62+
pub unsafe fn atomic_i128(x: *mut i128) {
63+
atomic_xadd(x, 1);
64+
}
5765
#[cfg(target_has_atomic = "ptr")]
5866
pub unsafe fn atomic_usize(x: *mut usize) {
5967
atomic_xadd(x, 1);

0 commit comments

Comments
 (0)