Skip to content

Commit d6a7e78

Browse files
committed
Test _mm_cvtps_ph
1 parent c437c3a commit d6a7e78

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

example/std_example.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,9 @@ unsafe fn test_simd() {
259259
test_mm_cvttps_epi32();
260260
test_mm_cvtsi128_si64();
261261

262+
#[cfg(not(jit))]
263+
test_mm_cvtps_ph();
264+
262265
test_mm_extract_epi8();
263266
test_mm_insert_epi16();
264267
test_mm_shuffle_epi8();
@@ -558,6 +561,21 @@ unsafe fn test_mm_cvttps_epi32() {
558561
}
559562
}
560563

564+
#[cfg(target_arch = "x86_64")]
565+
#[target_feature(enable = "f16c")]
566+
#[cfg(not(jit))]
567+
unsafe fn test_mm_cvtps_ph() {
568+
const F16_ONE: i16 = 0x3c00;
569+
const F16_TWO: i16 = 0x4000;
570+
const F16_THREE: i16 = 0x4200;
571+
const F16_FOUR: i16 = 0x4400;
572+
573+
let a = _mm_set_ps(1.0, 2.0, 3.0, 4.0);
574+
let r = _mm_cvtps_ph::<_MM_FROUND_CUR_DIRECTION>(a);
575+
let e = _mm_set_epi16(0, 0, 0, 0, F16_ONE, F16_TWO, F16_THREE, F16_FOUR);
576+
assert_eq_m128i(r, e);
577+
}
578+
561579
fn test_checked_mul() {
562580
let u: Option<u8> = u8::from_str_radix("1000", 10).ok();
563581
assert_eq!(u, None);

0 commit comments

Comments
 (0)