Skip to content

Commit 0490bcc

Browse files
committed
Add _mm_loadu_si64
Fix rust-lang#40
1 parent 9faced9 commit 0490bcc

File tree

1 file changed

+26
-0
lines changed
  • crates/core_arch/src/x86

1 file changed

+26
-0
lines changed

crates/core_arch/src/x86/sse.rs

+26
Original file line numberDiff line numberDiff line change
@@ -1251,6 +1251,25 @@ pub unsafe fn _mm_loadr_ps(p: *const f32) -> __m128 {
12511251
simd_shuffle4(a, a, [3, 2, 1, 0])
12521252
}
12531253

1254+
/// Loads unaligned 64-bits of integer data from memory into new vector.
1255+
///
1256+
/// `mem_addr` does not need to be aligned on any particular boundary.
1257+
///
1258+
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_loadu_si64)
1259+
#[inline]
1260+
#[target_feature(enable = "sse")]
1261+
#[cfg_attr(test, assert_instr(movups))]
1262+
#[stable(feature = "simd_x86", since = "1.46.0")]
1263+
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
1271+
}
1272+
12541273
/// Stores the upper half of `a` (64 bits) into memory.
12551274
///
12561275
/// This intrinsic corresponds to the `MOVHPS` instruction. The compiler may
@@ -3658,6 +3677,13 @@ mod tests {
36583677
assert_eq_m128(r, e);
36593678
}
36603679

3680+
#[simd_test(enable = "sse2")]
3681+
unsafe fn test_mm_loadu_si64() {
3682+
let a = _mm_set_epi64x(5, 0);
3683+
let r = _mm_loadu_si64(&a as *const _ as *const _);
3684+
assert_eq_m128i(a, r);
3685+
}
3686+
36613687
#[simd_test(enable = "sse")]
36623688
unsafe fn test_mm_storeh_pi() {
36633689
let mut vals = [0.0f32; 8];

0 commit comments

Comments
 (0)