Repository navigation
Simplify the definitions of some x86 intrinsincs - #2271
Conversation
|
r? @folkertdev rustbot has assigned @folkertdev. Use Why was this reviewer chosen?The reviewer was selected based on:
|
f24e847 to
15daeb6
Compare
_mm_(load|store)u_ps| pub const unsafe fn _mm_storel_epi64(mem_addr: *mut __m128i, a: __m128i) { | ||
| ptr::copy_nonoverlapping(ptr::addr_of!(a) as *const u8, mem_addr as *mut u8, 8); | ||
| let a = simd_extract!(a.as_u64x2(), 0, u64); | ||
| (mem_addr as *const u64).write_unaligned(a); |
There was a problem hiding this comment.
| (mem_addr as *const u64).write_unaligned(a); | |
| mem_addr.cast::<u64>().write_unaligned(a); |
maybe (the issue here is that you cast to *const and then try to write to it.
15daeb6 to
fa0349a
Compare
|
The PR should be fine now, but it won't pass CI until whatever issue plagues aarch64_be-unknown-linux-gnu is fixed. |
|
|
| #[allow(clippy::cast_ptr_alignment)] | ||
| #[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] | ||
| pub const unsafe fn _mm_loadu_si128(mem_addr: *const __m128i) -> __m128i { | ||
| let mut dst: __m128i = _mm_undefined_si128(); | ||
| ptr::copy_nonoverlapping( | ||
| mem_addr as *const u8, | ||
| ptr::addr_of_mut!(dst) as *mut u8, | ||
| mem::size_of::<__m128i>(), | ||
| ); | ||
| dst | ||
| mem_addr.read_unaligned() | ||
| } |
There was a problem hiding this comment.
All these allows could be expects, but I don't think this one should be needed?
There was a problem hiding this comment.
This one can indeed be removed.
expect is currently unused in this codebase. What about a follow-up PR to check all uses of allow that can be changed?
There was a problem hiding this comment.
I don't see why not, but new code should use the better patterns even if old code isn't updated
d6b11c7 to
9f2c9b9
Compare
9f2c9b9 to
a1db306
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
No description provided.