about summary refs log tree commit diff
path: root/example/std_example.rs
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2019-07-31 09:45:11 +0200
committerbjorn3 <bjorn3@users.noreply.github.com>2019-07-31 09:46:05 +0200
commitb806070a88cd0d6aaf99d3d31103c296473ca4a4 (patch)
tree141263268d10e86d703b1d24387618b93f326271 /example/std_example.rs
parentaa803f4fa664fe5e5fb91bd1e8679b37c9dde3f8 (diff)
downloadrust-b806070a88cd0d6aaf99d3d31103c296473ca4a4.tar.gz
rust-b806070a88cd0d6aaf99d3d31103c296473ca4a4.zip
Fix simd_cast
Diffstat (limited to 'example/std_example.rs')
-rw-r--r--example/std_example.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/example/std_example.rs b/example/std_example.rs
index 33523a12871..e28da13e4c8 100644
--- a/example/std_example.rs
+++ b/example/std_example.rs
@@ -68,6 +68,7 @@ unsafe fn test_simd() {
     test_mm256_movemask_epi8();
     test_mm_add_epi8();
     test_mm_add_pd();
+    test_mm_cvtepi8_epi16();
 
     let mask1 = _mm_movemask_epi8(dbg!(_mm_setr_epi8(255u8 as i8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)));
     assert_eq!(mask1, 1);
@@ -170,6 +171,18 @@ pub unsafe fn assert_eq_m128d(a: __m128d, b: __m128d) {
     }
 }
 
+#[target_feature(enable = "sse4.1")]
+unsafe fn test_mm_cvtepi8_epi16() {
+    let a = _mm_set1_epi8(10);
+    let r = _mm_cvtepi8_epi16(a);
+    let e = _mm_set1_epi16(10);
+    assert_eq_m128i(r, e);
+    let a = _mm_set1_epi8(-10);
+    let r = _mm_cvtepi8_epi16(a);
+    let e = _mm_set1_epi16(-10);
+    assert_eq_m128i(r, e);
+}
+
 #[derive(PartialEq)]
 enum LoopState {
     Continue(()),