@@ -122,6 +122,7 @@ where
122122 /// let v = u32x4::splat(0);
123123 /// assert_eq!(v.lanes(), 4);
124124 /// ```
125+ #[ inline]
125126 pub const fn lanes ( & self ) -> usize {
126127 Self :: LANES
127128 }
@@ -136,6 +137,7 @@ where
136137 /// let v = u32x4::splat(8);
137138 /// assert_eq!(v.as_array(), &[8, 8, 8, 8]);
138139 /// ```
140+ #[ inline]
139141 pub fn splat ( value : T ) -> Self {
140142 // This is preferred over `[value; N]`, since it's explicitly a splat:
141143 // https://github.com/rust-lang/rust/issues/97804
@@ -156,6 +158,7 @@ where
156158 /// let v: u64x4 = Simd::from_array([0, 1, 2, 3]);
157159 /// assert_eq!(v.as_array(), &[0, 1, 2, 3]);
158160 /// ```
161+ #[ inline]
159162 pub const fn as_array ( & self ) -> & [ T ; N ] {
160163 // SAFETY: `Simd<T, N>` is just an overaligned `[T; N]` with
161164 // potential padding at the end, so pointer casting to a
@@ -167,6 +170,7 @@ where
167170 }
168171
169172 /// Returns a mutable array reference containing the entire SIMD vector.
173+ #[ inline]
170174 pub fn as_mut_array ( & mut self ) -> & mut [ T ; N ] {
171175 // SAFETY: `Simd<T, N>` is just an overaligned `[T; N]` with
172176 // potential padding at the end, so pointer casting to a
@@ -184,6 +188,7 @@ where
184188 ///
185189 /// # Safety
186190 /// Reading `ptr` must be safe, as if by `<*const [T; N]>::read_unaligned`.
191+ #[ inline]
187192 const unsafe fn load ( ptr : * const [ T ; N ] ) -> Self {
188193 // There are potentially simpler ways to write this function, but this should result in
189194 // LLVM `load <N x T>`
@@ -204,6 +209,7 @@ where
204209 ///
205210 /// # Safety
206211 /// Writing to `ptr` must be safe, as if by `<*mut [T; N]>::write_unaligned`.
212+ #[ inline]
207213 const unsafe fn store ( self , ptr : * mut [ T ; N ] ) {
208214 // There are potentially simpler ways to write this function, but this should result in
209215 // LLVM `store <N x T>`
@@ -216,6 +222,7 @@ where
216222 }
217223
218224 /// Converts an array to a SIMD vector.
225+ #[ inline]
219226 pub const fn from_array ( array : [ T ; N ] ) -> Self {
220227 // SAFETY: `&array` is safe to read.
221228 //
@@ -228,6 +235,7 @@ where
228235 }
229236
230237 /// Converts a SIMD vector to an array.
238+ #[ inline]
231239 pub const fn to_array ( self ) -> [ T ; N ] {
232240 let mut tmp = core:: mem:: MaybeUninit :: uninit ( ) ;
233241 // SAFETY: writing to `tmp` is safe and initializes it.
@@ -258,7 +266,8 @@ where
258266 /// let v = u32x4::from_slice(&source);
259267 /// assert_eq!(v.as_array(), &[1, 2, 3, 4]);
260268 /// ```
261- #[ must_use]
269+ #[ inline]
270+ #[ track_caller]
262271 pub const fn from_slice ( slice : & [ T ] ) -> Self {
263272 assert ! (
264273 slice. len( ) >= Self :: LANES ,
@@ -287,6 +296,8 @@ where
287296 /// v.copy_to_slice(&mut dest);
288297 /// assert_eq!(&dest, &[1, 2, 3, 4, 0, 0]);
289298 /// ```
299+ #[ inline]
300+ #[ track_caller]
290301 pub fn copy_to_slice ( self , slice : & mut [ T ] ) {
291302 assert ! (
292303 slice. len( ) >= Self :: LANES ,
@@ -718,6 +729,7 @@ where
718729 LaneCount < N > : SupportedLaneCount ,
719730 T : SimdElement ,
720731{
732+ #[ inline]
721733 fn clone ( & self ) -> Self {
722734 * self
723735 }
@@ -862,6 +874,7 @@ where
862874 LaneCount < N > : SupportedLaneCount ,
863875 T : SimdElement ,
864876{
877+ #[ inline]
865878 fn from ( array : [ T ; N ] ) -> Self {
866879 Self :: from_array ( array)
867880 }
@@ -872,6 +885,7 @@ where
872885 LaneCount < N > : SupportedLaneCount ,
873886 T : SimdElement ,
874887{
888+ #[ inline]
875889 fn from ( vector : Simd < T , N > ) -> Self {
876890 vector. to_array ( )
877891 }
@@ -884,6 +898,7 @@ where
884898{
885899 type Error = core:: array:: TryFromSliceError ;
886900
901+ #[ inline]
887902 fn try_from ( slice : & [ T ] ) -> Result < Self , core:: array:: TryFromSliceError > {
888903 Ok ( Self :: from_array ( slice. try_into ( ) ?) )
889904 }
@@ -896,6 +911,7 @@ where
896911{
897912 type Error = core:: array:: TryFromSliceError ;
898913
914+ #[ inline]
899915 fn try_from ( slice : & mut [ T ] ) -> Result < Self , core:: array:: TryFromSliceError > {
900916 Ok ( Self :: from_array ( slice. try_into ( ) ?) )
901917 }
0 commit comments