about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--crates/core_simd/src/permute.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/core_simd/src/permute.rs b/crates/core_simd/src/permute.rs
index dd63c69c63d..a64fdbc9dd0 100644
--- a/crates/core_simd/src/permute.rs
+++ b/crates/core_simd/src/permute.rs
@@ -9,6 +9,15 @@ macro_rules! impl_shuffle_lane {
             /// Some SIMD shuffle instructions can be quite slow, so avoiding them by loading data
             /// into the desired patterns in advance is preferred, but shuffles are still faster
             /// than storing and reloading from memory.
+            ///
+            /// ```
+            /// # use core_simd::*;
+            // let a = f32x4::from_array([1.0, 2.0, 3.0, 4.0]);
+            // let b = f32x4::from_array([5.0, 6.0, 7.0, 8.0]);
+            // const IDXS: [u32; 4] = [4,0,3,7];
+            // let c = f32x4::shuffle::<IDXS>(a,b);
+            // assert_eq!(f32x4::from_array([5.0, 1.0, 4.0, 8.0]), c);
+            /// ```
             #[inline]
             pub fn shuffle<const IDX: [u32; $n]>(self, second: Self) -> Self {
                 unsafe { crate::intrinsics::$fn(self, second, IDX) }