Skip to content

Commit 9903975

Browse files
committed
Add 128-bit atomics
1 parent 74e5b7d commit 9903975

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

src/libcore/sync/atomic.rs

+18
Original file line numberDiff line numberDiff line change
@@ -1314,6 +1314,24 @@ atomic_int! {
13141314
unstable(feature = "integer_atomics", issue = "32976"),
13151315
u64 AtomicU64 ATOMIC_U64_INIT
13161316
}
1317+
#[cfg(not(stage0))]
1318+
#[cfg(target_has_atomic = "128")]
1319+
atomic_int! {
1320+
unstable(feature = "i128", issue = "35118"),
1321+
unstable(feature = "i128", issue = "35118"),
1322+
unstable(feature = "i128", issue = "35118"),
1323+
unstable(feature = "i128", issue = "35118"),
1324+
i128 AtomicI128 ATOMIC_I128_INIT
1325+
}
1326+
#[cfg(not(stage0))]
1327+
#[cfg(target_has_atomic = "128")]
1328+
atomic_int! {
1329+
unstable(feature = "i128", issue = "35118"),
1330+
unstable(feature = "i128", issue = "35118"),
1331+
unstable(feature = "i128", issue = "35118"),
1332+
unstable(feature = "i128", issue = "35118"),
1333+
u128 AtomicU128 ATOMIC_U128_INIT
1334+
}
13171335
#[cfg(target_has_atomic = "ptr")]
13181336
atomic_int!{
13191337
stable(feature = "rust1", since = "1.0.0"),

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

+9-1
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)