about summary refs log tree commit diff
path: root/example
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2023-06-06 09:24:10 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2023-06-06 09:34:21 +0000
commitc09ef968782c8ada9aa5427605b1b7925ac60d32 (patch)
treebde9851b69b759980e07b9fe30e293ef149b76c1 /example
parente4d0811360e79b2789f27a65eed7d3248e1e092c (diff)
downloadrust-c09ef968782c8ada9aa5427605b1b7925ac60d32.tar.gz
rust-c09ef968782c8ada9aa5427605b1b7925ac60d32.zip
Implement _mm_shuffle_epi8
Diffstat (limited to 'example')
-rw-r--r--example/std_example.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/example/std_example.rs b/example/std_example.rs
index 811dbb267cd..1bf0ff64c92 100644
--- a/example/std_example.rs
+++ b/example/std_example.rs
@@ -197,6 +197,7 @@ unsafe fn test_simd() {
 
     test_mm_extract_epi8();
     test_mm_insert_epi16();
+    test_mm_shuffle_epi8();
 
     test_mm256_shuffle_epi8();
     test_mm256_permute2x128_si256();
@@ -346,6 +347,26 @@ unsafe fn test_mm_insert_epi16() {
 }
 
 #[cfg(target_arch = "x86_64")]
+#[target_feature(enable = "ssse3")]
+unsafe fn test_mm_shuffle_epi8() {
+    #[rustfmt::skip]
+        let a = _mm_setr_epi8(
+            1, 2, 3, 4, 5, 6, 7, 8,
+            9, 10, 11, 12, 13, 14, 15, 16,
+        );
+    #[rustfmt::skip]
+        let b = _mm_setr_epi8(
+            4, 128_u8 as i8, 4, 3,
+            24, 12, 6, 19,
+            12, 5, 5, 10,
+            4, 1, 8, 0,
+        );
+    let expected = _mm_setr_epi8(5, 0, 5, 4, 9, 13, 7, 4, 13, 6, 6, 11, 5, 2, 9, 1);
+    let r = _mm_shuffle_epi8(a, b);
+    assert_eq_m128i(r, expected);
+}
+
+#[cfg(target_arch = "x86_64")]
 #[target_feature(enable = "avx2")]
 unsafe fn test_mm256_shuffle_epi8() {
     #[rustfmt::skip]