Skip to content

Commit 2645f57

Browse files
committed
Fix pointer type for _mm512_loadu_si512
The C intrinsic uses a void pointer but we must specify a type in Rust. This PR makes it consistent with the equivalent SSE and AVX intrinsics, as well as `_mm512_store_si512`.
1 parent 54c8837 commit 2645f57

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

crates/core_arch/src/x86/avx512f.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34435,7 +34435,7 @@ pub unsafe fn _mm_storeu_epi64(mem_addr: *mut i64, a: __m128i) {
3443534435
#[target_feature(enable = "avx512f")]
3443634436
#[unstable(feature = "stdarch_x86_avx512", issue = "111137")]
3443734437
#[cfg_attr(test, assert_instr(vmovups))] //should be vmovdqu32
34438-
pub unsafe fn _mm512_loadu_si512(mem_addr: *const i32) -> __m512i {
34438+
pub unsafe fn _mm512_loadu_si512(mem_addr: *const __m512i) -> __m512i {
3443934439
ptr::read_unaligned(mem_addr as *const __m512i)
3444034440
}
3444134441

@@ -34509,7 +34509,7 @@ pub unsafe fn _mm512_storeu_ps(mem_addr: *mut f32, a: __m512) {
3450934509
#[target_feature(enable = "avx512f")]
3451034510
#[unstable(feature = "stdarch_x86_avx512", issue = "111137")]
3451134511
#[cfg_attr(test, assert_instr(vmovaps))] //should be vmovdqa32
34512-
pub unsafe fn _mm512_load_si512(mem_addr: *const i32) -> __m512i {
34512+
pub unsafe fn _mm512_load_si512(mem_addr: *const __m512i) -> __m512i {
3451334513
ptr::read(mem_addr as *const __m512i)
3451434514
}
3451534515

@@ -57232,7 +57232,7 @@ mod tests {
5723257232
unsafe fn test_mm512_loadu_si512() {
5723357233
let a = &[4, 3, 2, 5, 8, 9, 64, 50, -4, -3, -2, -5, -8, -9, -64, -50];
5723457234
let p = a.as_ptr();
57235-
let r = _mm512_loadu_si512(black_box(p));
57235+
let r = _mm512_loadu_si512(black_box(p.cast()));
5723657236
let e = _mm512_setr_epi32(4, 3, 2, 5, 8, 9, 64, 50, -4, -3, -2, -5, -8, -9, -64, -50);
5723757237
assert_eq_m512i(r, e);
5723857238
}
@@ -57255,7 +57255,7 @@ mod tests {
5725557255
data: [4, 3, 2, 5, 8, 9, 64, 50, -4, -3, -2, -5, -8, -9, -64, -50],
5725657256
};
5725757257
let p = (a.data).as_ptr();
57258-
let r = _mm512_load_si512(black_box(p));
57258+
let r = _mm512_load_si512(black_box(p.cast()));
5725957259
let e = _mm512_setr_epi32(4, 3, 2, 5, 8, 9, 64, 50, -4, -3, -2, -5, -8, -9, -64, -50);
5726057260
assert_eq_m512i(r, e);
5726157261
}

crates/core_arch/src/x86/gfni.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ mod tests {
867867
#[unstable(feature = "stdarch_x86_avx512", issue = "111137")]
868868
unsafe fn load_m512i_word<T>(data: &[T], word_index: usize) -> __m512i {
869869
let byte_offset = word_index * 64 / size_of::<T>();
870-
let pointer = data.as_ptr().add(byte_offset) as *const i32;
870+
let pointer = data.as_ptr().add(byte_offset) as *const __m512i;
871871
_mm512_loadu_si512(black_box(pointer))
872872
}
873873

0 commit comments

Comments
 (0)