Skip to content

Commit e6aede2

Browse files
committed
nontemporal_store: make sure that the intrinsic is truly just a hint
1 parent 89fe6df commit e6aede2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: core/src/intrinsics.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -2386,12 +2386,12 @@ extern "rust-intrinsic" {
23862386
#[rustc_nounwind]
23872387
pub fn catch_unwind(try_fn: fn(*mut u8), data: *mut u8, catch_fn: fn(*mut u8, *mut u8)) -> i32;
23882388

2389-
/// Emits a `!nontemporal` store according to LLVM (see their docs).
2390-
/// Probably will never become stable.
2389+
/// Emits a `nontemporal` store, which gives a hint to the CPU that the data should not be held
2390+
/// in cache. Except for performance, this is fully equivalent to `ptr.write(val)`.
23912391
///
2392-
/// Do NOT use this intrinsic; "nontemporal" operations do not exist in our memory model!
2393-
/// It exists to support current stdarch, but the plan is to change stdarch and remove this intrinsic.
2394-
/// See <https://github.com/rust-lang/rust/issues/114582> for some more discussion.
2392+
/// Not all architectures provide such an operation. For instance, x86 does not: while `MOVNT`
2393+
/// exists, that operation is *not* equivalent to `ptr.write(val)` (`MOVNT` writes can be reordered
2394+
/// in ways that are not allowed for regular writes).
23952395
#[rustc_nounwind]
23962396
pub fn nontemporal_store<T>(ptr: *mut T, val: T);
23972397

0 commit comments

Comments
 (0)