Skip to content

Commit 0309be1

Browse files
gnzlbgalexcrichton
authored andcommitted
[breaking change] fixes unsoundness in avx non-temporal store APIs. Closes #575 (#576)
1 parent 3932d27 commit 0309be1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

coresimd/x86/avx.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1941,8 +1941,8 @@ pub unsafe fn _mm256_lddqu_si256(mem_addr: *const __m256i) -> __m256i {
19411941
#[target_feature(enable = "avx")]
19421942
#[cfg_attr(test, assert_instr(vmovntps))] // FIXME vmovntdq
19431943
#[stable(feature = "simd_x86", since = "1.27.0")]
1944-
pub unsafe fn _mm256_stream_si256(mem_addr: *const __m256i, a: __m256i) {
1945-
intrinsics::nontemporal_store(mem::transmute(mem_addr), a);
1944+
pub unsafe fn _mm256_stream_si256(mem_addr: *mut __m256i, a: __m256i) {
1945+
intrinsics::nontemporal_store(mem_addr, a);
19461946
}
19471947

19481948
/// Moves double-precision values from a 256-bit vector of `[4 x double]`
@@ -1954,8 +1954,8 @@ pub unsafe fn _mm256_stream_si256(mem_addr: *const __m256i, a: __m256i) {
19541954
#[target_feature(enable = "avx")]
19551955
#[cfg_attr(test, assert_instr(vmovntps))] // FIXME vmovntpd
19561956
#[stable(feature = "simd_x86", since = "1.27.0")]
1957-
pub unsafe fn _mm256_stream_pd(mem_addr: *const f64, a: __m256d) {
1958-
intrinsics::nontemporal_store(mem::transmute(mem_addr), a);
1957+
pub unsafe fn _mm256_stream_pd(mem_addr: *mut f64, a: __m256d) {
1958+
intrinsics::nontemporal_store(mem_addr as *mut __m256d, a);
19591959
}
19601960

19611961
/// Moves single-precision floating point values from a 256-bit vector
@@ -1968,8 +1968,8 @@ pub unsafe fn _mm256_stream_pd(mem_addr: *const f64, a: __m256d) {
19681968
#[target_feature(enable = "avx")]
19691969
#[cfg_attr(test, assert_instr(vmovntps))]
19701970
#[stable(feature = "simd_x86", since = "1.27.0")]
1971-
pub unsafe fn _mm256_stream_ps(mem_addr: *const f32, a: __m256) {
1972-
intrinsics::nontemporal_store(mem::transmute(mem_addr), a);
1971+
pub unsafe fn _mm256_stream_ps(mem_addr: *mut f32, a: __m256) {
1972+
intrinsics::nontemporal_store(mem_addr as *mut __m256, a);
19731973
}
19741974

19751975
/// Compute the approximate reciprocal of packed single-precision (32-bit)

0 commit comments

Comments
 (0)