Skip to content

Commit 44bc687

Browse files
p32bloBurntSushi
authored andcommitted
Add commented implementation of _mm_cvtepi8_epi64
1 parent 321bd80 commit 44bc687

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

src/x86/sse41.rs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::mem;
44

55
#[cfg(test)]
66
use stdsimd_test::assert_instr;
7-
use simd_llvm::{simd_cast, simd_shuffle4, simd_shuffle8};
7+
use simd_llvm::{simd_cast, simd_shuffle2, simd_shuffle4, simd_shuffle8};
88

99
use v128::*;
1010

@@ -261,20 +261,32 @@ pub unsafe fn _mm_cmpeq_epi64(a: i64x2, b: i64x2) -> i64x2 {
261261
}
262262

263263
/// Sign extend packed 8-bit integers in `a` to packed 16-bit integers
264+
#[inline(always)]
264265
#[target_feature = "+sse4.1"]
265266
#[cfg_attr(test, assert_instr(pmovsxbw))]
266267
pub unsafe fn _mm_cvtepi8_epi16(a: i8x16) -> i16x8 {
267268
simd_cast::<::v64::i8x8, _>(simd_shuffle8(a, a, [0, 1, 2, 3, 4, 5, 6, 7]))
268269
}
269270

270271
/// Sign extend packed 8-bit integers in `a` to packed 32-bit integers
272+
#[inline(always)]
271273
#[target_feature = "+sse4.1"]
272274
#[cfg_attr(test, assert_instr(pmovsxbd))]
273275
pub unsafe fn _mm_cvtepi8_epi32(a: i8x16) -> i32x4 {
274276
let cast = simd_cast::<_, ::v512::i32x16>(a);
275277
simd_shuffle4(cast, cast, [0, 1, 2, 3])
276278
}
277279

280+
/// Sign extend packed 8-bit integers in the low 8 bytes of `a` to packed 64-bit integers
281+
/*
282+
#[inline(always)]
283+
#[target_feature = "+sse4.1"]
284+
#[cfg_attr(test, assert_instr(pmovsxbq))]
285+
pub unsafe fn _mm_cvtepi8_epi64(a: i8x16) -> i64x2 {
286+
simd_cast::<::v16::i8x2, _>(simd_shuffle2(a, a, [0, 1]))
287+
}
288+
*/
289+
278290
/// Returns the dot product of two f64x2 vectors.
279291
///
280292
/// `imm8[1:0]` is the broadcast mask, and `imm8[5:4]` is the condition mask.
@@ -799,6 +811,20 @@ mod tests {
799811
assert_eq!(r, e);
800812
}
801813

814+
/*
815+
#[simd_test = "sse4.1"]
816+
unsafe fn _mm_cvtepi8_epi64() {
817+
let a = i8x16::splat(10);
818+
let r = sse41::_mm_cvtepi8_epi64(a);
819+
let e = i64x2::splat(10);
820+
assert_eq!(r, e);
821+
let a = i8x16::splat(-10);
822+
let r = sse41::_mm_cvtepi8_epi64(a);
823+
let e = i64x2::splat(-10);
824+
assert_eq!(r, e);
825+
}
826+
*/
827+
802828
#[simd_test = "sse4.1"]
803829
unsafe fn _mm_dp_pd() {
804830
let a = f64x2::new(2.0, 3.0);

0 commit comments

Comments
 (0)