move __m128i to the v128 module
This commit is contained in:
parent
5fb068f74c
commit
dd9a3f92ff
9 changed files with 47 additions and 43 deletions
|
|
@ -42,14 +42,24 @@ define_impl! {
|
|||
x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15
|
||||
}
|
||||
|
||||
define_from!(u64x2, i64x2, u32x4, i32x4, u16x8, i16x8, u8x16, i8x16);
|
||||
define_from!(i64x2, u64x2, u32x4, i32x4, u16x8, i16x8, u8x16, i8x16);
|
||||
define_from!(u32x4, u64x2, i64x2, i32x4, u16x8, i16x8, u8x16, i8x16);
|
||||
define_from!(i32x4, u64x2, i64x2, u32x4, u16x8, i16x8, u8x16, i8x16);
|
||||
define_from!(u16x8, u64x2, i64x2, u32x4, i32x4, i16x8, u8x16, i8x16);
|
||||
define_from!(i16x8, u64x2, i64x2, u32x4, i32x4, u16x8, u8x16, i8x16);
|
||||
define_from!(u8x16, u64x2, i64x2, u32x4, i32x4, u16x8, i16x8, i8x16);
|
||||
define_from!(i8x16, u64x2, i64x2, u32x4, i32x4, u16x8, i16x8, u8x16);
|
||||
define_ty_doc! {
|
||||
__m128i, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 |
|
||||
/// 128-bit wide signed integer vector type
|
||||
}
|
||||
define_impl! {
|
||||
__m128i, i8, 16, __m128i,
|
||||
x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15
|
||||
}
|
||||
|
||||
define_from!(u64x2, i64x2, u32x4, i32x4, u16x8, i16x8, u8x16, i8x16, __m128i);
|
||||
define_from!(i64x2, u64x2, u32x4, i32x4, u16x8, i16x8, u8x16, i8x16, __m128i);
|
||||
define_from!(u32x4, u64x2, i64x2, i32x4, u16x8, i16x8, u8x16, i8x16, __m128i);
|
||||
define_from!(i32x4, u64x2, i64x2, u32x4, u16x8, i16x8, u8x16, i8x16, __m128i);
|
||||
define_from!(u16x8, u64x2, i64x2, u32x4, i32x4, i16x8, u8x16, i8x16, __m128i);
|
||||
define_from!(i16x8, u64x2, i64x2, u32x4, i32x4, u16x8, u8x16, i8x16, __m128i);
|
||||
define_from!(u8x16, u64x2, i64x2, u32x4, i32x4, u16x8, i16x8, i8x16, __m128i);
|
||||
define_from!(i8x16, u64x2, i64x2, u32x4, i32x4, u16x8, i16x8, u8x16, __m128i);
|
||||
define_from!(__m128i, i8x16, u64x2, i64x2, u32x4, i32x4, u16x8, i16x8, u8x16);
|
||||
|
||||
define_common_ops!(
|
||||
f64x2,
|
||||
|
|
@ -61,7 +71,8 @@ define_common_ops!(
|
|||
u16x8,
|
||||
i16x8,
|
||||
u8x16,
|
||||
i8x16
|
||||
i8x16,
|
||||
__m128i
|
||||
);
|
||||
define_float_ops!(f64x2, f32x4);
|
||||
define_integer_ops!(
|
||||
|
|
@ -72,9 +83,10 @@ define_integer_ops!(
|
|||
(u16x8, u16),
|
||||
(i16x8, i16),
|
||||
(u8x16, u8),
|
||||
(i8x16, i8)
|
||||
(i8x16, i8),
|
||||
(__m128i, i8)
|
||||
);
|
||||
define_signed_integer_ops!(i64x2, i32x4, i16x8, i8x16);
|
||||
define_signed_integer_ops!(i64x2, i32x4, i16x8, i8x16, __m128i);
|
||||
define_casts!(
|
||||
(f64x2, f32x2, as_f32x2),
|
||||
(f64x2, u64x2, as_u64x2),
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ use core::ptr;
|
|||
use stdsimd_test::assert_instr;
|
||||
|
||||
use simd_llvm::{simd_cast, simd_shuffle2, simd_shuffle4, simd_shuffle8};
|
||||
use v128::{f32x4, f64x2, i32x4, i64x2};
|
||||
use v128::{__m128i, f32x4, f64x2, i32x4, i64x2};
|
||||
use v256::*;
|
||||
use x86::{__m128i, __m256i};
|
||||
use x86::__m256i;
|
||||
|
||||
/// Add packed double-precision (64-bit) floating-point elements
|
||||
/// in `a` and `b`.
|
||||
|
|
@ -2530,10 +2530,10 @@ mod tests {
|
|||
use stdsimd_test::simd_test;
|
||||
use test::black_box; // Used to inhibit constant-folding.
|
||||
|
||||
use v128::{f32x4, f64x2, i32x4, i64x2, i8x16};
|
||||
use v128::{__m128i, f32x4, f64x2, i32x4, i64x2, i8x16};
|
||||
use v256::*;
|
||||
use x86::i586::avx;
|
||||
use x86::{__m128i, __m256i};
|
||||
use x86::__m256i;
|
||||
|
||||
#[simd_test = "avx"]
|
||||
unsafe fn _mm256_add_pd() {
|
||||
|
|
@ -4146,7 +4146,7 @@ mod tests {
|
|||
);
|
||||
let lo =
|
||||
i8x16::new(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
|
||||
let r = avx::_mm256_set_m128i(hi, lo);
|
||||
let r = avx::_mm256_set_m128i(hi.into(), lo.into());
|
||||
#[cfg_attr(rustfmt, rustfmt_skip)]
|
||||
let e = i8x32::new(
|
||||
1, 2, 3, 4, 5, 6, 7, 8,
|
||||
|
|
@ -4184,7 +4184,7 @@ mod tests {
|
|||
17, 18, 19, 20, 21, 22, 23, 24,
|
||||
25, 26, 27, 28, 29, 30, 31, 32,
|
||||
);
|
||||
let r = avx::_mm256_setr_m128i(lo, hi);
|
||||
let r = avx::_mm256_setr_m128i(lo.into(), hi.into());
|
||||
#[cfg_attr(rustfmt, rustfmt_skip)]
|
||||
let e = i8x32::new(
|
||||
1, 2, 3, 4, 5, 6, 7, 8,
|
||||
|
|
@ -4289,10 +4289,11 @@ mod tests {
|
|||
25, 26, 27, 28, 29, 30, 31, 32
|
||||
);
|
||||
|
||||
assert_eq!(hi, e);
|
||||
assert_eq!(hi, e.into());
|
||||
assert_eq!(
|
||||
lo,
|
||||
i8x16::new(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)
|
||||
.into()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ use simd_llvm::{simd_shuffle16, simd_shuffle32};
|
|||
|
||||
use v256::*;
|
||||
use v128::*;
|
||||
use x86::{__m128i, __m256i};
|
||||
use x86::__m256i;
|
||||
|
||||
#[cfg(test)]
|
||||
use stdsimd_test::assert_instr;
|
||||
|
|
@ -2911,7 +2911,7 @@ mod tests {
|
|||
use v256::*;
|
||||
use v128::*;
|
||||
use x86::i586::avx2;
|
||||
use x86::{__m128i, __m256i};
|
||||
use x86::__m256i;
|
||||
use std;
|
||||
|
||||
#[simd_test = "avx2"]
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ use core::ptr;
|
|||
|
||||
use simd_llvm::{simd_cast, simd_shuffle16, simd_shuffle2, simd_shuffle4,
|
||||
simd_shuffle8};
|
||||
use x86::__m128i;
|
||||
use v128::*;
|
||||
use v64::*;
|
||||
|
||||
|
|
@ -2176,7 +2175,6 @@ mod tests {
|
|||
use test::black_box; // Used to inhibit constant-folding.
|
||||
|
||||
use v128::*;
|
||||
use x86::__m128i;
|
||||
use x86::i586::sse2;
|
||||
|
||||
#[simd_test = "sse2"]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
//! Streaming SIMD Extensions 3 (SSE3)
|
||||
|
||||
use x86::__m128i;
|
||||
use simd_llvm::{simd_shuffle2, simd_shuffle4};
|
||||
use v128::*;
|
||||
|
||||
|
|
@ -184,7 +183,8 @@ mod tests {
|
|||
#[simd_test = "sse3"]
|
||||
unsafe fn _mm_lddqu_si128() {
|
||||
let a =
|
||||
i8x16::new(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
|
||||
i8x16::new(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)
|
||||
.into();
|
||||
let r = sse3::_mm_lddqu_si128(&a);
|
||||
assert_eq!(a, r);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
use stdsimd_test::assert_instr;
|
||||
|
||||
use v128::*;
|
||||
use x86::__m128i;
|
||||
|
||||
/// String contains unsigned 8-bit characters *(Default)*
|
||||
pub const _SIDD_UBYTE_OPS: i8 = 0b0000_0000;
|
||||
|
|
@ -103,8 +102,8 @@ pub unsafe fn _mm_cmpistrm(a: __m128i, b: __m128i, imm8: i8) -> u8x16 {
|
|||
/// # #[target_feature = "+sse4.2"]
|
||||
/// # fn worker() {
|
||||
///
|
||||
/// use stdsimd::simd::u8x16;
|
||||
/// use stdsimd::vendor::{__m128i, _mm_cmpistri, _SIDD_CMP_EQUAL_ORDERED};
|
||||
/// use stdsimd::simd::{__m128i, u8x16};
|
||||
/// use stdsimd::vendor::{_mm_cmpistri, _SIDD_CMP_EQUAL_ORDERED};
|
||||
///
|
||||
/// let haystack = b"This is a long string of text data\r\n\tthat extends
|
||||
/// multiple lines";
|
||||
|
|
@ -145,8 +144,8 @@ pub unsafe fn _mm_cmpistrm(a: __m128i, b: __m128i, imm8: i8) -> u8x16 {
|
|||
/// # if cfg_feature_enabled!("sse4.2") {
|
||||
/// # #[target_feature = "+sse4.2"]
|
||||
/// # fn worker() {
|
||||
/// use stdsimd::simd::u8x16;
|
||||
/// use stdsimd::vendor::{__m128i, _mm_cmpistri, _SIDD_CMP_EQUAL_ANY};
|
||||
/// use stdsimd::simd::{__m128i, u8x16};
|
||||
/// use stdsimd::vendor::{_mm_cmpistri, _SIDD_CMP_EQUAL_ANY};
|
||||
///
|
||||
/// // Ensure your input is 16 byte aligned
|
||||
/// let password = b"hunter2\0\0\0\0\0\0\0\0\0";
|
||||
|
|
@ -186,8 +185,8 @@ pub unsafe fn _mm_cmpistrm(a: __m128i, b: __m128i, imm8: i8) -> u8x16 {
|
|||
/// # if cfg_feature_enabled!("sse4.2") {
|
||||
/// # #[target_feature = "+sse4.2"]
|
||||
/// # fn worker() {
|
||||
/// use stdsimd::simd::u8x16;
|
||||
/// use stdsimd::vendor::{__m128i, _mm_cmpistri, _SIDD_CMP_RANGES};
|
||||
/// use stdsimd::simd::{__m128i, u8x16};
|
||||
/// use stdsimd::vendor::{_mm_cmpistri, _SIDD_CMP_RANGES};
|
||||
/// # let b = __m128i::from(u8x16::load(b":;<=>?@[\\]^_`abc", 0));
|
||||
///
|
||||
/// // Specify the ranges of values to be searched for [A-Za-z0-9].
|
||||
|
|
@ -225,8 +224,8 @@ pub unsafe fn _mm_cmpistrm(a: __m128i, b: __m128i, imm8: i8) -> u8x16 {
|
|||
/// # if cfg_feature_enabled!("sse4.2") {
|
||||
/// # #[target_feature = "+sse4.2"]
|
||||
/// # fn worker() {
|
||||
/// use stdsimd::simd::u16x8;
|
||||
/// use stdsimd::vendor::{__m128i, _mm_cmpistri};
|
||||
/// use stdsimd::simd::{__m128i, u16x8};
|
||||
/// use stdsimd::vendor::{_mm_cmpistri};
|
||||
/// use stdsimd::vendor::{_SIDD_UWORD_OPS, _SIDD_CMP_EQUAL_EACH};
|
||||
///
|
||||
/// # let mut some_utf16_words = [0u16; 8];
|
||||
|
|
@ -399,8 +398,8 @@ pub unsafe fn _mm_cmpestrm(
|
|||
/// # #[target_feature = "+sse4.2"]
|
||||
/// # fn worker() {
|
||||
///
|
||||
/// use stdsimd::simd::u8x16;
|
||||
/// use stdsimd::vendor::{__m128i, _mm_cmpestri, _SIDD_CMP_EQUAL_ORDERED};
|
||||
/// use stdsimd::simd::{__m128i, u8x16};
|
||||
/// use stdsimd::vendor::{_mm_cmpestri, _SIDD_CMP_EQUAL_ORDERED};
|
||||
///
|
||||
/// // The string we want to find a substring in
|
||||
/// let haystack = b"Split \r\n\t line ";
|
||||
|
|
@ -612,7 +611,6 @@ mod tests {
|
|||
|
||||
use std::ptr;
|
||||
use v128::*;
|
||||
use x86::__m128i;
|
||||
use x86::i586::sse42;
|
||||
|
||||
// Currently one cannot `load` a &[u8] that is is less than 16
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
//! `i686`'s Streaming SIMD Extensions 4.1 (SSE4.1)
|
||||
|
||||
use v128::*;
|
||||
use x86::__m128i;
|
||||
|
||||
#[cfg(test)]
|
||||
use stdsimd_test::assert_instr;
|
||||
|
|
@ -164,7 +163,6 @@ mod tests {
|
|||
use stdsimd_test::simd_test;
|
||||
use x86::i686::sse41;
|
||||
use v128::*;
|
||||
use x86::__m128i;
|
||||
|
||||
#[simd_test = "sse4.1"]
|
||||
unsafe fn _mm_extract_epi64() {
|
||||
|
|
|
|||
|
|
@ -26,9 +26,6 @@ mod x86_64;
|
|||
#[cfg(target_arch = "x86_64")]
|
||||
pub use self::x86_64::*;
|
||||
|
||||
/// 128-bit wide signed integer vector type
|
||||
#[allow(non_camel_case_types)]
|
||||
pub type __m128i = ::v128::i8x16;
|
||||
/// 256-bit wide signed integer vector type
|
||||
#[allow(non_camel_case_types)]
|
||||
pub type __m256i = ::v256::i8x32;
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@ mod example {
|
|||
|
||||
let mut needle = needle.to_string().into_bytes();
|
||||
needle.resize(16, 0);
|
||||
let vneedle = vendor::__m128i::from(s::u8x16::load(&needle, 0));
|
||||
let vneedle = s::__m128i::from(s::u8x16::load(&needle, 0));
|
||||
|
||||
let mut haystack = haystack.to_string().into_bytes();
|
||||
haystack.resize(16, 0);
|
||||
let vhaystack = vendor::__m128i::from(s::u8x16::load(&haystack, 0));
|
||||
let vhaystack = s::__m128i::from(s::u8x16::load(&haystack, 0));
|
||||
|
||||
unsafe {
|
||||
vendor::_mm_cmpestri(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue