Skip to content

Commit 8d734b6

Browse files
committed
Simplify _mm_loadu_si64
As suggested by @Amanieu
1 parent 8ed548d commit 8d734b6

File tree

1 file changed

+3
-8
lines changed
  • crates/core_arch/src/x86

1 file changed

+3
-8
lines changed

crates/core_arch/src/x86/sse.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -1259,15 +1259,10 @@ pub unsafe fn _mm_loadr_ps(p: *const f32) -> __m128 {
12591259
#[inline]
12601260
#[target_feature(enable = "sse")]
12611261
#[cfg_attr(test, assert_instr(movups))]
1262-
#[stable(feature = "simd_x86", since = "1.46.0")]
1262+
#[stable(feature = "simd_x86_mm_loadu_si64", since = "1.46.0")]
12631263
pub unsafe fn _mm_loadu_si64(mem_addr: *const u8) -> __m128i {
1264-
let mut dst = _mm_setzero_si128();
1265-
ptr::copy_nonoverlapping(
1266-
mem_addr,
1267-
&mut dst as *mut __m128i as *mut u8,
1268-
8, // == 64 bits == mem::size_of::<__m128i>() / 2
1269-
);
1270-
dst
1264+
let val = ptr::read_unaligned(mem_addr as *const i64);
1265+
_mm_set_epi64x(val, 0)
12711266
}
12721267

12731268
/// Stores the upper half of `a` (64 bits) into memory.

0 commit comments

Comments
 (0)