Skip to content
Merged
14 changes: 11 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,20 @@ mod v32 {

define_ty! { i16x2, i16, i16 }
define_impl! { i16x2, i16, 2, i16x2, x0, x1 }
define_ty! { u16x2, u16, u16 }
define_impl! { u16x2, u16, 2, i16x2, x0, x1 }

define_ty! { i8x4, i8, i8, i8, i8 }
define_impl! { i8x4, i8, 4, i8x4, x0, x1, x2, x3 }

define_ty! { u8x4, u8, u8, u8, u8 }
define_impl! { u8x4, u8, 4, i8x4, x0, x1, x2, x3 }

define_casts!((i8x4, i32x4, as_i32x4), (i16x2, i64x2, as_i64x2));
define_casts!(
(i16x2, i64x2, as_i64x2),
(u16x2, i64x2, as_i64x2),
(i8x4, i32x4, as_i32x4),
(u8x4, i32x4, as_i32x4)
);
}

/// 16-bit wide vector tpyes
Expand All @@ -185,8 +191,10 @@ mod v16 {

define_ty! { i8x2, i8, i8 }
define_impl! { i8x2, i8, 2, i8x2, x0, x1 }
define_ty! { u8x2, u8, u8 }
define_impl! { u8x2, u8, 2, i8x2, x0, x1 }

define_casts!((i8x2, i64x2, as_i64x2));
define_casts!((i8x2, i64x2, as_i64x2), (u8x2, i64x2, as_i64x2));
}

#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
Expand Down
8 changes: 4 additions & 4 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ macro_rules! test_arithmetic_ {

#[cfg(test)]
#[macro_export]
macro_rules! test_neg_ {
macro_rules! test_neg_ {
($tn:ident, $zero:expr, $one:expr, $two:expr, $four:expr) => {
{
let z = $tn::splat($zero);
Expand Down Expand Up @@ -573,7 +573,7 @@ macro_rules! test_bit_arithmetic_ {

#[cfg(test)]
#[macro_export]
macro_rules! test_ops_si {
macro_rules! test_ops_si {
($($tn:ident),+) => {
$(
test_arithmetic_!($tn, 0, 1, 2, 4);
Expand All @@ -585,7 +585,7 @@ macro_rules! test_bit_arithmetic_ {

#[cfg(test)]
#[macro_export]
macro_rules! test_ops_ui {
macro_rules! test_ops_ui {
($($tn:ident),+) => {
$(
test_arithmetic_!($tn, 0, 1, 2, 4);
Expand All @@ -596,7 +596,7 @@ macro_rules! test_bit_arithmetic_ {

#[cfg(test)]
#[macro_export]
macro_rules! test_ops_f {
macro_rules! test_ops_f {
($($tn:ident),+) => {
$(
test_arithmetic_!($tn, 0., 1., 2., 4.);
Expand Down
5 changes: 4 additions & 1 deletion src/v64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,14 @@ define_casts!(
(u8x8, i8x8, as_i8x8),
(i8x8, u8x8, as_u8x8),
(i8x8, i16x8, as_i16x8),
(u8x8, i16x8, as_i16x8),
(i16x4, i32x4, as_i32x4),
(i32x2, i64x2, as_i64x2),
(u8x8, u16x8, as_u16x8),
(u16x4, u32x4, as_u32x4),
(u32x2, u64x2, as_u64x2)
(u16x4, i32x4, as_i32x4),
(u32x2, u64x2, as_u64x2),
(u32x2, i64x2, as_i64x2)
);

#[cfg(test)]
Expand Down
16 changes: 16 additions & 0 deletions src/x86/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,22 @@ macro_rules! constify_imm4 {
}
}

macro_rules! constify_imm3 {
($imm8:expr, $expand:ident) => {
#[allow(overflowing_literals)]
match $imm8 & 0b111 {
0 => $expand!(0),
1 => $expand!(1),
2 => $expand!(2),
3 => $expand!(3),
4 => $expand!(4),
5 => $expand!(5),
6 => $expand!(6),
_ => $expand!(7),
}
}
}

macro_rules! constify_imm2 {
($imm8:expr, $expand:ident) => {
#[allow(overflowing_literals)]
Expand Down
Loading