Skip to content

Commit ffd9c65

Browse files
committed
Make _mm_prefetch safe
1 parent fd369b8 commit ffd9c65

File tree

1 file changed

+4
-2
lines changed
  • crates/core_arch/src/x86

1 file changed

+4
-2
lines changed

crates/core_arch/src/x86/sse.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1897,11 +1897,13 @@ pub const _MM_HINT_ET1: i32 = 6;
18971897
#[cfg_attr(test, assert_instr(prefetchnta, STRATEGY = _MM_HINT_NTA))]
18981898
#[rustc_legacy_const_generics(1)]
18991899
#[stable(feature = "simd_x86", since = "1.27.0")]
1900-
pub unsafe fn _mm_prefetch<const STRATEGY: i32>(p: *const i8) {
1900+
pub fn _mm_prefetch<const STRATEGY: i32>(p: *const i8) {
19011901
static_assert_uimm_bits!(STRATEGY, 3);
19021902
// We use the `llvm.prefetch` intrinsic with `cache type` = 1 (data cache).
19031903
// `locality` and `rw` are based on our `STRATEGY`.
1904-
prefetch(p, (STRATEGY >> 2) & 1, STRATEGY & 3, 1);
1904+
unsafe {
1905+
prefetch(p, (STRATEGY >> 2) & 1, STRATEGY & 3, 1);
1906+
}
19051907
}
19061908

19071909
/// Returns vector of type __m128 with indeterminate elements.with indetermination elements.

0 commit comments

Comments
 (0)