Skip to content

Commit 8c237c1

Browse files
committed
Use simd_extract_dyn for extract
- Remove comments regarding rust-lang/compiler-team#838
1 parent 62ff5cc commit 8c237c1

File tree

2 files changed

+1
-12
lines changed

2 files changed

+1
-12
lines changed

Diff for: crates/core_arch/src/macros.rs

-7
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,7 @@ macro_rules! types {
108108
// SAFETY: this type is just an overaligned `[T; N]` with
109109
// potential padding at the end, so pointer casting to a
110110
// `&[T; N]` is safe.
111-
//
112-
// NOTE: This deliberately doesn't just use `&self.0` because it may soon be banned
113-
// see https://github.com/rust-lang/compiler-team/issues/838
114111
unsafe { &*(self as *const Self as *const [$elem_type; $len]) }
115-
116112
}
117113

118114
/// Returns a mutable array reference containing the entire SIMD vector.
@@ -121,9 +117,6 @@ macro_rules! types {
121117
// SAFETY: this type is just an overaligned `[T; N]` with
122118
// potential padding at the end, so pointer casting to a
123119
// `&mut [T; N]` is safe.
124-
//
125-
// NOTE: This deliberately doesn't just use `&mut self.0` because it may soon be banned
126-
// see https://github.com/rust-lang/compiler-team/issues/838
127120
unsafe { &mut *(self as *mut Self as *mut [$elem_type; $len]) }
128121
}
129122
}

Diff for: crates/core_arch/src/simd.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,9 @@ macro_rules! simd_ty {
3333
unsafe { simd_shuffle!(one, one, [0; $len]) }
3434
}
3535

36-
/// Extract the element at position `index`.
37-
/// `index` is not a constant so this is not efficient!
38-
/// Use for testing only.
39-
// FIXME: Workaround rust@60637
4036
#[inline(always)]
4137
pub(crate) fn extract(&self, index: usize) -> $elem_type {
42-
self.as_array()[index]
38+
unsafe { $crate::intrinsics::simd::simd_extract_dyn(self, index as u32) }
4339
}
4440

4541
#[inline]

0 commit comments

Comments
 (0)