diff options
| author | Caleb Zulawski <caleb.zulawski@gmail.com> | 2021-08-07 20:38:41 +0000 |
|---|---|---|
| committer | Caleb Zulawski <caleb.zulawski@gmail.com> | 2021-08-07 20:38:41 +0000 |
| commit | f7f29683a8f63e967c471c8cc27c7e43709bc6d1 (patch) | |
| tree | 9162de48cd0dc1af18c9c0f24cdcf32ded1d1546 | |
| parent | 88f79d4a6f609ffec80f83e4c9a71ff8939b4384 (diff) | |
| download | rust-f7f29683a8f63e967c471c8cc27c7e43709bc6d1.tar.gz rust-f7f29683a8f63e967c471c8cc27c7e43709bc6d1.zip | |
Remove aliases from most tests
| -rw-r--r-- | crates/core_simd/tests/f32_ops.rs | 2 | ||||
| -rw-r--r-- | crates/core_simd/tests/f64_ops.rs | 2 | ||||
| -rw-r--r-- | crates/core_simd/tests/i16_ops.rs | 2 | ||||
| -rw-r--r-- | crates/core_simd/tests/i32_ops.rs | 2 | ||||
| -rw-r--r-- | crates/core_simd/tests/i64_ops.rs | 2 | ||||
| -rw-r--r-- | crates/core_simd/tests/i8_ops.rs | 2 | ||||
| -rw-r--r-- | crates/core_simd/tests/isize_ops.rs | 2 | ||||
| -rw-r--r-- | crates/core_simd/tests/ops_macros.rs | 102 | ||||
| -rw-r--r-- | crates/core_simd/tests/u16_ops.rs | 2 | ||||
| -rw-r--r-- | crates/core_simd/tests/u32_ops.rs | 2 | ||||
| -rw-r--r-- | crates/core_simd/tests/u64_ops.rs | 2 | ||||
| -rw-r--r-- | crates/core_simd/tests/u8_ops.rs | 2 | ||||
| -rw-r--r-- | crates/core_simd/tests/usize_ops.rs | 2 |
13 files changed, 64 insertions, 62 deletions
diff --git a/crates/core_simd/tests/f32_ops.rs b/crates/core_simd/tests/f32_ops.rs index 98283110097..414a832b1be 100644 --- a/crates/core_simd/tests/f32_ops.rs +++ b/crates/core_simd/tests/f32_ops.rs @@ -2,4 +2,4 @@ #[macro_use] mod ops_macros; -impl_float_tests! { SimdF32, f32, i32 } +impl_float_tests! { f32, i32 } diff --git a/crates/core_simd/tests/f64_ops.rs b/crates/core_simd/tests/f64_ops.rs index 0818b0c5c5a..e0a1fa33f33 100644 --- a/crates/core_simd/tests/f64_ops.rs +++ b/crates/core_simd/tests/f64_ops.rs @@ -2,4 +2,4 @@ #[macro_use] mod ops_macros; -impl_float_tests! { SimdF64, f64, i64 } +impl_float_tests! { f64, i64 } diff --git a/crates/core_simd/tests/i16_ops.rs b/crates/core_simd/tests/i16_ops.rs index 33d92faa595..f6c5d74fbbc 100644 --- a/crates/core_simd/tests/i16_ops.rs +++ b/crates/core_simd/tests/i16_ops.rs @@ -2,4 +2,4 @@ #[macro_use] mod ops_macros; -impl_signed_tests! { SimdI16, i16 } +impl_signed_tests! { i16 } diff --git a/crates/core_simd/tests/i32_ops.rs b/crates/core_simd/tests/i32_ops.rs index 481bca23e83..69a831c52a3 100644 --- a/crates/core_simd/tests/i32_ops.rs +++ b/crates/core_simd/tests/i32_ops.rs @@ -2,4 +2,4 @@ #[macro_use] mod ops_macros; -impl_signed_tests! { SimdI32, i32 } +impl_signed_tests! { i32 } diff --git a/crates/core_simd/tests/i64_ops.rs b/crates/core_simd/tests/i64_ops.rs index 5ab0614c848..37ac0811742 100644 --- a/crates/core_simd/tests/i64_ops.rs +++ b/crates/core_simd/tests/i64_ops.rs @@ -2,4 +2,4 @@ #[macro_use] mod ops_macros; -impl_signed_tests! { SimdI64, i64 } +impl_signed_tests! { i64 } diff --git a/crates/core_simd/tests/i8_ops.rs b/crates/core_simd/tests/i8_ops.rs index 0db9ee47a9e..11e4a5cd6a9 100644 --- a/crates/core_simd/tests/i8_ops.rs +++ b/crates/core_simd/tests/i8_ops.rs @@ -2,4 +2,4 @@ #[macro_use] mod ops_macros; -impl_signed_tests! { SimdI8, i8 } +impl_signed_tests! { i8 } diff --git a/crates/core_simd/tests/isize_ops.rs b/crates/core_simd/tests/isize_ops.rs index 8f5470b685c..5cc9de2b7ff 100644 --- a/crates/core_simd/tests/isize_ops.rs +++ b/crates/core_simd/tests/isize_ops.rs @@ -2,4 +2,4 @@ #[macro_use] mod ops_macros; -impl_signed_tests! { SimdIsize, isize } +impl_signed_tests! { isize } diff --git a/crates/core_simd/tests/ops_macros.rs b/crates/core_simd/tests/ops_macros.rs index 81553c34aa7..0c45ea2367c 100644 --- a/crates/core_simd/tests/ops_macros.rs +++ b/crates/core_simd/tests/ops_macros.rs @@ -3,19 +3,19 @@ /// Compares the vector operation to the equivalent scalar operation. #[macro_export] macro_rules! impl_unary_op_test { - { $vector:ty, $scalar:ty, $trait:ident :: $fn:ident, $scalar_fn:expr } => { + { $scalar:ty, $trait:ident :: $fn:ident, $scalar_fn:expr } => { test_helpers::test_lanes! { fn $fn<const LANES: usize>() { test_helpers::test_unary_elementwise( - &<$vector as core::ops::$trait>::$fn, + &<core_simd::Simd<$scalar, LANES> as core::ops::$trait>::$fn, &$scalar_fn, &|_| true, ); } } }; - { $vector:ty, $scalar:ty, $trait:ident :: $fn:ident } => { - impl_unary_op_test! { $vector, $scalar, $trait::$fn, <$scalar as core::ops::$trait>::$fn } + { $scalar:ty, $trait:ident :: $fn:ident } => { + impl_unary_op_test! { $scalar, $trait::$fn, <$scalar as core::ops::$trait>::$fn } }; } @@ -24,14 +24,15 @@ macro_rules! impl_unary_op_test { /// Compares the vector operation to the equivalent scalar operation. #[macro_export] macro_rules! impl_binary_op_test { - { $vector:ty, $scalar:ty, $trait:ident :: $fn:ident, $trait_assign:ident :: $fn_assign:ident, $scalar_fn:expr } => { + { $scalar:ty, $trait:ident :: $fn:ident, $trait_assign:ident :: $fn_assign:ident, $scalar_fn:expr } => { mod $fn { use super::*; + use core_simd::Simd; test_helpers::test_lanes! { fn normal<const LANES: usize>() { test_helpers::test_binary_elementwise( - &<$vector as core::ops::$trait>::$fn, + &<Simd<$scalar, LANES> as core::ops::$trait>::$fn, &$scalar_fn, &|_, _| true, ); @@ -39,7 +40,7 @@ macro_rules! impl_binary_op_test { fn scalar_rhs<const LANES: usize>() { test_helpers::test_binary_scalar_rhs_elementwise( - &<$vector as core::ops::$trait<$scalar>>::$fn, + &<Simd<$scalar, LANES> as core::ops::$trait<$scalar>>::$fn, &$scalar_fn, &|_, _| true, ); @@ -47,7 +48,7 @@ macro_rules! impl_binary_op_test { fn scalar_lhs<const LANES: usize>() { test_helpers::test_binary_scalar_lhs_elementwise( - &<$scalar as core::ops::$trait<$vector>>::$fn, + &<$scalar as core::ops::$trait<Simd<$scalar, LANES>>>::$fn, &$scalar_fn, &|_, _| true, ); @@ -55,7 +56,7 @@ macro_rules! impl_binary_op_test { fn assign<const LANES: usize>() { test_helpers::test_binary_elementwise( - &|mut a, b| { <$vector as core::ops::$trait_assign>::$fn_assign(&mut a, b); a }, + &|mut a, b| { <Simd<$scalar, LANES> as core::ops::$trait_assign>::$fn_assign(&mut a, b); a }, &$scalar_fn, &|_, _| true, ); @@ -63,7 +64,7 @@ macro_rules! impl_binary_op_test { fn assign_scalar_rhs<const LANES: usize>() { test_helpers::test_binary_scalar_rhs_elementwise( - &|mut a, b| { <$vector as core::ops::$trait_assign<$scalar>>::$fn_assign(&mut a, b); a }, + &|mut a, b| { <Simd<$scalar, LANES> as core::ops::$trait_assign<$scalar>>::$fn_assign(&mut a, b); a }, &$scalar_fn, &|_, _| true, ); @@ -71,8 +72,8 @@ macro_rules! impl_binary_op_test { } } }; - { $vector:ty, $scalar:ty, $trait:ident :: $fn:ident, $trait_assign:ident :: $fn_assign:ident } => { - impl_binary_op_test! { $vector, $scalar, $trait::$fn, $trait_assign::$fn_assign, <$scalar as core::ops::$trait>::$fn } + { $scalar:ty, $trait:ident :: $fn:ident, $trait_assign:ident :: $fn_assign:ident } => { + impl_binary_op_test! { $scalar, $trait::$fn, $trait_assign::$fn_assign, <$scalar as core::ops::$trait>::$fn } }; } @@ -84,14 +85,15 @@ macro_rules! impl_binary_op_test { /// Compares the vector operation to the equivalent scalar operation. #[macro_export] macro_rules! impl_binary_checked_op_test { - { $vector:ty, $scalar:ty, $trait:ident :: $fn:ident, $trait_assign:ident :: $fn_assign:ident, $scalar_fn:expr, $check_fn:expr } => { + { $scalar:ty, $trait:ident :: $fn:ident, $trait_assign:ident :: $fn_assign:ident, $scalar_fn:expr, $check_fn:expr } => { mod $fn { use super::*; + use core_simd::Simd; test_helpers::test_lanes! { fn normal<const LANES: usize>() { test_helpers::test_binary_elementwise( - &<$vector as core::ops::$trait>::$fn, + &<Simd<$scalar, LANES> as core::ops::$trait>::$fn, &$scalar_fn, &|x, y| x.iter().zip(y.iter()).all(|(x, y)| $check_fn(*x, *y)), ); @@ -99,7 +101,7 @@ macro_rules! impl_binary_checked_op_test { fn scalar_rhs<const LANES: usize>() { test_helpers::test_binary_scalar_rhs_elementwise( - &<$vector as core::ops::$trait<$scalar>>::$fn, + &<Simd<$scalar, LANES> as core::ops::$trait<$scalar>>::$fn, &$scalar_fn, &|x, y| x.iter().all(|x| $check_fn(*x, y)), ); @@ -107,7 +109,7 @@ macro_rules! impl_binary_checked_op_test { fn scalar_lhs<const LANES: usize>() { test_helpers::test_binary_scalar_lhs_elementwise( - &<$scalar as core::ops::$trait<$vector>>::$fn, + &<$scalar as core::ops::$trait<Simd<$scalar, LANES>>>::$fn, &$scalar_fn, &|x, y| y.iter().all(|y| $check_fn(x, *y)), ); @@ -115,7 +117,7 @@ macro_rules! impl_binary_checked_op_test { fn assign<const LANES: usize>() { test_helpers::test_binary_elementwise( - &|mut a, b| { <$vector as core::ops::$trait_assign>::$fn_assign(&mut a, b); a }, + &|mut a, b| { <Simd<$scalar, LANES> as core::ops::$trait_assign>::$fn_assign(&mut a, b); a }, &$scalar_fn, &|x, y| x.iter().zip(y.iter()).all(|(x, y)| $check_fn(*x, *y)), ) @@ -123,7 +125,7 @@ macro_rules! impl_binary_checked_op_test { fn assign_scalar_rhs<const LANES: usize>() { test_helpers::test_binary_scalar_rhs_elementwise( - &|mut a, b| { <$vector as core::ops::$trait_assign<$scalar>>::$fn_assign(&mut a, b); a }, + &|mut a, b| { <Simd<$scalar, LANES> as core::ops::$trait_assign<$scalar>>::$fn_assign(&mut a, b); a }, &$scalar_fn, &|x, y| x.iter().all(|x| $check_fn(*x, y)), ) @@ -131,8 +133,8 @@ macro_rules! impl_binary_checked_op_test { } } }; - { $vector:ty, $scalar:ty, $trait:ident :: $fn:ident, $trait_assign:ident :: $fn_assign:ident, $check_fn:expr } => { - impl_binary_nonzero_rhs_op_test! { $vector, $scalar, $trait::$fn, $trait_assign::$fn_assign, <$scalar as core::ops::$trait>::$fn, $check_fn } + { $scalar:ty, $trait:ident :: $fn:ident, $trait_assign:ident :: $fn_assign:ident, $check_fn:expr } => { + impl_binary_checked_op_test! { $scalar, $trait::$fn, $trait_assign::$fn_assign, <$scalar as core::ops::$trait>::$fn, $check_fn } }; } @@ -216,9 +218,9 @@ macro_rules! impl_common_integer_tests { /// Implement tests for signed integers. #[macro_export] macro_rules! impl_signed_tests { - { $vector:ident, $scalar:tt } => { + { $scalar:tt } => { mod $scalar { - type Vector<const LANES: usize> = core_simd::$vector<LANES>; + type Vector<const LANES: usize> = core_simd::Simd<Scalar, LANES>; type Scalar = $scalar; impl_common_integer_tests! { Vector, Scalar } @@ -305,18 +307,18 @@ macro_rules! impl_signed_tests { } } - impl_binary_op_test!(Vector<LANES>, Scalar, Add::add, AddAssign::add_assign, Scalar::wrapping_add); - impl_binary_op_test!(Vector<LANES>, Scalar, Sub::sub, SubAssign::sub_assign, Scalar::wrapping_sub); - impl_binary_op_test!(Vector<LANES>, Scalar, Mul::mul, MulAssign::mul_assign, Scalar::wrapping_mul); + impl_binary_op_test!(Scalar, Add::add, AddAssign::add_assign, Scalar::wrapping_add); + impl_binary_op_test!(Scalar, Sub::sub, SubAssign::sub_assign, Scalar::wrapping_sub); + impl_binary_op_test!(Scalar, Mul::mul, MulAssign::mul_assign, Scalar::wrapping_mul); // Exclude Div and Rem panicking cases - impl_binary_checked_op_test!(Vector<LANES>, Scalar, Div::div, DivAssign::div_assign, Scalar::wrapping_div, |x, y| y != 0 && !(x == Scalar::MIN && y == -1)); - impl_binary_checked_op_test!(Vector<LANES>, Scalar, Rem::rem, RemAssign::rem_assign, Scalar::wrapping_rem, |x, y| y != 0 && !(x == Scalar::MIN && y == -1)); + impl_binary_checked_op_test!(Scalar, Div::div, DivAssign::div_assign, Scalar::wrapping_div, |x, y| y != 0 && !(x == Scalar::MIN && y == -1)); + impl_binary_checked_op_test!(Scalar, Rem::rem, RemAssign::rem_assign, Scalar::wrapping_rem, |x, y| y != 0 && !(x == Scalar::MIN && y == -1)); - impl_unary_op_test!(Vector<LANES>, Scalar, Not::not); - impl_binary_op_test!(Vector<LANES>, Scalar, BitAnd::bitand, BitAndAssign::bitand_assign); - impl_binary_op_test!(Vector<LANES>, Scalar, BitOr::bitor, BitOrAssign::bitor_assign); - impl_binary_op_test!(Vector<LANES>, Scalar, BitXor::bitxor, BitXorAssign::bitxor_assign); + impl_unary_op_test!(Scalar, Not::not); + impl_binary_op_test!(Scalar, BitAnd::bitand, BitAndAssign::bitand_assign); + impl_binary_op_test!(Scalar, BitOr::bitor, BitOrAssign::bitor_assign); + impl_binary_op_test!(Scalar, BitXor::bitxor, BitXorAssign::bitxor_assign); } } } @@ -324,9 +326,9 @@ macro_rules! impl_signed_tests { /// Implement tests for unsigned integers. #[macro_export] macro_rules! impl_unsigned_tests { - { $vector:ident, $scalar:tt } => { + { $scalar:tt } => { mod $scalar { - type Vector<const LANES: usize> = core_simd::$vector<LANES>; + type Vector<const LANES: usize> = core_simd::Simd<Scalar, LANES>; type Scalar = $scalar; impl_common_integer_tests! { Vector, Scalar } @@ -339,18 +341,18 @@ macro_rules! impl_unsigned_tests { } } - impl_binary_op_test!(Vector<LANES>, Scalar, Add::add, AddAssign::add_assign, Scalar::wrapping_add); - impl_binary_op_test!(Vector<LANES>, Scalar, Sub::sub, SubAssign::sub_assign, Scalar::wrapping_sub); - impl_binary_op_test!(Vector<LANES>, Scalar, Mul::mul, MulAssign::mul_assign, Scalar::wrapping_mul); + impl_binary_op_test!(Scalar, Add::add, AddAssign::add_assign, Scalar::wrapping_add); + impl_binary_op_test!(Scalar, Sub::sub, SubAssign::sub_assign, Scalar::wrapping_sub); + impl_binary_op_test!(Scalar, Mul::mul, MulAssign::mul_assign, Scalar::wrapping_mul); // Exclude Div and Rem panicking cases - impl_binary_checked_op_test!(Vector<LANES>, Scalar, Div::div, DivAssign::div_assign, Scalar::wrapping_div, |_, y| y != 0); - impl_binary_checked_op_test!(Vector<LANES>, Scalar, Rem::rem, RemAssign::rem_assign, Scalar::wrapping_rem, |_, y| y != 0); + impl_binary_checked_op_test!(Scalar, Div::div, DivAssign::div_assign, Scalar::wrapping_div, |_, y| y != 0); + impl_binary_checked_op_test!(Scalar, Rem::rem, RemAssign::rem_assign, Scalar::wrapping_rem, |_, y| y != 0); - impl_unary_op_test!(Vector<LANES>, Scalar, Not::not); - impl_binary_op_test!(Vector<LANES>, Scalar, BitAnd::bitand, BitAndAssign::bitand_assign); - impl_binary_op_test!(Vector<LANES>, Scalar, BitOr::bitor, BitOrAssign::bitor_assign); - impl_binary_op_test!(Vector<LANES>, Scalar, BitXor::bitxor, BitXorAssign::bitxor_assign); + impl_unary_op_test!(Scalar, Not::not); + impl_binary_op_test!(Scalar, BitAnd::bitand, BitAndAssign::bitand_assign); + impl_binary_op_test!(Scalar, BitOr::bitor, BitOrAssign::bitor_assign); + impl_binary_op_test!(Scalar, BitXor::bitxor, BitXorAssign::bitxor_assign); } } } @@ -358,17 +360,17 @@ macro_rules! impl_unsigned_tests { /// Implement tests for floating point numbers. #[macro_export] macro_rules! impl_float_tests { - { $vector:ident, $scalar:tt, $int_scalar:tt } => { + { $scalar:tt, $int_scalar:tt } => { mod $scalar { - type Vector<const LANES: usize> = core_simd::$vector<LANES>; + type Vector<const LANES: usize> = core_simd::Simd<Scalar, LANES>; type Scalar = $scalar; - impl_unary_op_test!(Vector<LANES>, Scalar, Neg::neg); - impl_binary_op_test!(Vector<LANES>, Scalar, Add::add, AddAssign::add_assign); - impl_binary_op_test!(Vector<LANES>, Scalar, Sub::sub, SubAssign::sub_assign); - impl_binary_op_test!(Vector<LANES>, Scalar, Mul::mul, MulAssign::mul_assign); - impl_binary_op_test!(Vector<LANES>, Scalar, Div::div, DivAssign::div_assign); - impl_binary_op_test!(Vector<LANES>, Scalar, Rem::rem, RemAssign::rem_assign); + impl_unary_op_test!(Scalar, Neg::neg); + impl_binary_op_test!(Scalar, Add::add, AddAssign::add_assign); + impl_binary_op_test!(Scalar, Sub::sub, SubAssign::sub_assign); + impl_binary_op_test!(Scalar, Mul::mul, MulAssign::mul_assign); + impl_binary_op_test!(Scalar, Div::div, DivAssign::div_assign); + impl_binary_op_test!(Scalar, Rem::rem, RemAssign::rem_assign); test_helpers::test_lanes! { fn is_sign_positive<const LANES: usize>() { diff --git a/crates/core_simd/tests/u16_ops.rs b/crates/core_simd/tests/u16_ops.rs index d220dae6456..9ae3bd6a47d 100644 --- a/crates/core_simd/tests/u16_ops.rs +++ b/crates/core_simd/tests/u16_ops.rs @@ -2,4 +2,4 @@ #[macro_use] mod ops_macros; -impl_unsigned_tests! { SimdU16, u16 } +impl_unsigned_tests! { u16 } diff --git a/crates/core_simd/tests/u32_ops.rs b/crates/core_simd/tests/u32_ops.rs index f27cc30a17f..de34b73d652 100644 --- a/crates/core_simd/tests/u32_ops.rs +++ b/crates/core_simd/tests/u32_ops.rs @@ -2,4 +2,4 @@ #[macro_use] mod ops_macros; -impl_unsigned_tests! { SimdU32, u32 } +impl_unsigned_tests! { u32 } diff --git a/crates/core_simd/tests/u64_ops.rs b/crates/core_simd/tests/u64_ops.rs index ec3df39c53c..8ee5a318c83 100644 --- a/crates/core_simd/tests/u64_ops.rs +++ b/crates/core_simd/tests/u64_ops.rs @@ -2,4 +2,4 @@ #[macro_use] mod ops_macros; -impl_unsigned_tests! { SimdU64, u64 } +impl_unsigned_tests! { u64 } diff --git a/crates/core_simd/tests/u8_ops.rs b/crates/core_simd/tests/u8_ops.rs index 2c52a52b921..6d721112128 100644 --- a/crates/core_simd/tests/u8_ops.rs +++ b/crates/core_simd/tests/u8_ops.rs @@ -2,4 +2,4 @@ #[macro_use] mod ops_macros; -impl_unsigned_tests! { SimdU8, u8 } +impl_unsigned_tests! { u8 } diff --git a/crates/core_simd/tests/usize_ops.rs b/crates/core_simd/tests/usize_ops.rs index 070edc4e266..9c7b1687a08 100644 --- a/crates/core_simd/tests/usize_ops.rs +++ b/crates/core_simd/tests/usize_ops.rs @@ -2,4 +2,4 @@ #[macro_use] mod ops_macros; -impl_unsigned_tests! { SimdUsize, usize } +impl_unsigned_tests! { usize } |
