Skip to content

Commit f7f2968

Browse files
committed
Remove aliases from most tests
1 parent 88f79d4 commit f7f2968

File tree

13 files changed

+64
-62
lines changed

13 files changed

+64
-62
lines changed

crates/core_simd/tests/f32_ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
#[macro_use]
44
mod ops_macros;
5-
impl_float_tests! { SimdF32, f32, i32 }
5+
impl_float_tests! { f32, i32 }

crates/core_simd/tests/f64_ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
#[macro_use]
44
mod ops_macros;
5-
impl_float_tests! { SimdF64, f64, i64 }
5+
impl_float_tests! { f64, i64 }

crates/core_simd/tests/i16_ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
#[macro_use]
44
mod ops_macros;
5-
impl_signed_tests! { SimdI16, i16 }
5+
impl_signed_tests! { i16 }

crates/core_simd/tests/i32_ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
#[macro_use]
44
mod ops_macros;
5-
impl_signed_tests! { SimdI32, i32 }
5+
impl_signed_tests! { i32 }

crates/core_simd/tests/i64_ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
#[macro_use]
44
mod ops_macros;
5-
impl_signed_tests! { SimdI64, i64 }
5+
impl_signed_tests! { i64 }

crates/core_simd/tests/i8_ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
#[macro_use]
44
mod ops_macros;
5-
impl_signed_tests! { SimdI8, i8 }
5+
impl_signed_tests! { i8 }

crates/core_simd/tests/isize_ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
#[macro_use]
44
mod ops_macros;
5-
impl_signed_tests! { SimdIsize, isize }
5+
impl_signed_tests! { isize }

crates/core_simd/tests/ops_macros.rs

Lines changed: 52 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
/// Compares the vector operation to the equivalent scalar operation.
44
#[macro_export]
55
macro_rules! impl_unary_op_test {
6-
{ $vector:ty, $scalar:ty, $trait:ident :: $fn:ident, $scalar_fn:expr } => {
6+
{ $scalar:ty, $trait:ident :: $fn:ident, $scalar_fn:expr } => {
77
test_helpers::test_lanes! {
88
fn $fn<const LANES: usize>() {
99
test_helpers::test_unary_elementwise(
10-
&<$vector as core::ops::$trait>::$fn,
10+
&<core_simd::Simd<$scalar, LANES> as core::ops::$trait>::$fn,
1111
&$scalar_fn,
1212
&|_| true,
1313
);
1414
}
1515
}
1616
};
17-
{ $vector:ty, $scalar:ty, $trait:ident :: $fn:ident } => {
18-
impl_unary_op_test! { $vector, $scalar, $trait::$fn, <$scalar as core::ops::$trait>::$fn }
17+
{ $scalar:ty, $trait:ident :: $fn:ident } => {
18+
impl_unary_op_test! { $scalar, $trait::$fn, <$scalar as core::ops::$trait>::$fn }
1919
};
2020
}
2121

@@ -24,55 +24,56 @@ macro_rules! impl_unary_op_test {
2424
/// Compares the vector operation to the equivalent scalar operation.
2525
#[macro_export]
2626
macro_rules! impl_binary_op_test {
27-
{ $vector:ty, $scalar:ty, $trait:ident :: $fn:ident, $trait_assign:ident :: $fn_assign:ident, $scalar_fn:expr } => {
27+
{ $scalar:ty, $trait:ident :: $fn:ident, $trait_assign:ident :: $fn_assign:ident, $scalar_fn:expr } => {
2828
mod $fn {
2929
use super::*;
30+
use core_simd::Simd;
3031

3132
test_helpers::test_lanes! {
3233
fn normal<const LANES: usize>() {
3334
test_helpers::test_binary_elementwise(
34-
&<$vector as core::ops::$trait>::$fn,
35+
&<Simd<$scalar, LANES> as core::ops::$trait>::$fn,
3536
&$scalar_fn,
3637
&|_, _| true,
3738
);
3839
}
3940

4041
fn scalar_rhs<const LANES: usize>() {
4142
test_helpers::test_binary_scalar_rhs_elementwise(
42-
&<$vector as core::ops::$trait<$scalar>>::$fn,
43+
&<Simd<$scalar, LANES> as core::ops::$trait<$scalar>>::$fn,
4344
&$scalar_fn,
4445
&|_, _| true,
4546
);
4647
}
4748

4849
fn scalar_lhs<const LANES: usize>() {
4950
test_helpers::test_binary_scalar_lhs_elementwise(
50-
&<$scalar as core::ops::$trait<$vector>>::$fn,
51+
&<$scalar as core::ops::$trait<Simd<$scalar, LANES>>>::$fn,
5152
&$scalar_fn,
5253
&|_, _| true,
5354
);
5455
}
5556

5657
fn assign<const LANES: usize>() {
5758
test_helpers::test_binary_elementwise(
58-
&|mut a, b| { <$vector as core::ops::$trait_assign>::$fn_assign(&mut a, b); a },
59+
&|mut a, b| { <Simd<$scalar, LANES> as core::ops::$trait_assign>::$fn_assign(&mut a, b); a },
5960
&$scalar_fn,
6061
&|_, _| true,
6162
);
6263
}
6364

6465
fn assign_scalar_rhs<const LANES: usize>() {
6566
test_helpers::test_binary_scalar_rhs_elementwise(
66-
&|mut a, b| { <$vector as core::ops::$trait_assign<$scalar>>::$fn_assign(&mut a, b); a },
67+
&|mut a, b| { <Simd<$scalar, LANES> as core::ops::$trait_assign<$scalar>>::$fn_assign(&mut a, b); a },
6768
&$scalar_fn,
6869
&|_, _| true,
6970
);
7071
}
7172
}
7273
}
7374
};
74-
{ $vector:ty, $scalar:ty, $trait:ident :: $fn:ident, $trait_assign:ident :: $fn_assign:ident } => {
75-
impl_binary_op_test! { $vector, $scalar, $trait::$fn, $trait_assign::$fn_assign, <$scalar as core::ops::$trait>::$fn }
75+
{ $scalar:ty, $trait:ident :: $fn:ident, $trait_assign:ident :: $fn_assign:ident } => {
76+
impl_binary_op_test! { $scalar, $trait::$fn, $trait_assign::$fn_assign, <$scalar as core::ops::$trait>::$fn }
7677
};
7778
}
7879

@@ -84,55 +85,56 @@ macro_rules! impl_binary_op_test {
8485
/// Compares the vector operation to the equivalent scalar operation.
8586
#[macro_export]
8687
macro_rules! impl_binary_checked_op_test {
87-
{ $vector:ty, $scalar:ty, $trait:ident :: $fn:ident, $trait_assign:ident :: $fn_assign:ident, $scalar_fn:expr, $check_fn:expr } => {
88+
{ $scalar:ty, $trait:ident :: $fn:ident, $trait_assign:ident :: $fn_assign:ident, $scalar_fn:expr, $check_fn:expr } => {
8889
mod $fn {
8990
use super::*;
91+
use core_simd::Simd;
9092

9193
test_helpers::test_lanes! {
9294
fn normal<const LANES: usize>() {
9395
test_helpers::test_binary_elementwise(
94-
&<$vector as core::ops::$trait>::$fn,
96+
&<Simd<$scalar, LANES> as core::ops::$trait>::$fn,
9597
&$scalar_fn,
9698
&|x, y| x.iter().zip(y.iter()).all(|(x, y)| $check_fn(*x, *y)),
9799
);
98100
}
99101

100102
fn scalar_rhs<const LANES: usize>() {
101103
test_helpers::test_binary_scalar_rhs_elementwise(
102-
&<$vector as core::ops::$trait<$scalar>>::$fn,
104+
&<Simd<$scalar, LANES> as core::ops::$trait<$scalar>>::$fn,
103105
&$scalar_fn,
104106
&|x, y| x.iter().all(|x| $check_fn(*x, y)),
105107
);
106108
}
107109

108110
fn scalar_lhs<const LANES: usize>() {
109111
test_helpers::test_binary_scalar_lhs_elementwise(
110-
&<$scalar as core::ops::$trait<$vector>>::$fn,
112+
&<$scalar as core::ops::$trait<Simd<$scalar, LANES>>>::$fn,
111113
&$scalar_fn,
112114
&|x, y| y.iter().all(|y| $check_fn(x, *y)),
113115
);
114116
}
115117

116118
fn assign<const LANES: usize>() {
117119
test_helpers::test_binary_elementwise(
118-
&|mut a, b| { <$vector as core::ops::$trait_assign>::$fn_assign(&mut a, b); a },
120+
&|mut a, b| { <Simd<$scalar, LANES> as core::ops::$trait_assign>::$fn_assign(&mut a, b); a },
119121
&$scalar_fn,
120122
&|x, y| x.iter().zip(y.iter()).all(|(x, y)| $check_fn(*x, *y)),
121123
)
122124
}
123125

124126
fn assign_scalar_rhs<const LANES: usize>() {
125127
test_helpers::test_binary_scalar_rhs_elementwise(
126-
&|mut a, b| { <$vector as core::ops::$trait_assign<$scalar>>::$fn_assign(&mut a, b); a },
128+
&|mut a, b| { <Simd<$scalar, LANES> as core::ops::$trait_assign<$scalar>>::$fn_assign(&mut a, b); a },
127129
&$scalar_fn,
128130
&|x, y| x.iter().all(|x| $check_fn(*x, y)),
129131
)
130132
}
131133
}
132134
}
133135
};
134-
{ $vector:ty, $scalar:ty, $trait:ident :: $fn:ident, $trait_assign:ident :: $fn_assign:ident, $check_fn:expr } => {
135-
impl_binary_nonzero_rhs_op_test! { $vector, $scalar, $trait::$fn, $trait_assign::$fn_assign, <$scalar as core::ops::$trait>::$fn, $check_fn }
136+
{ $scalar:ty, $trait:ident :: $fn:ident, $trait_assign:ident :: $fn_assign:ident, $check_fn:expr } => {
137+
impl_binary_checked_op_test! { $scalar, $trait::$fn, $trait_assign::$fn_assign, <$scalar as core::ops::$trait>::$fn, $check_fn }
136138
};
137139
}
138140

@@ -216,9 +218,9 @@ macro_rules! impl_common_integer_tests {
216218
/// Implement tests for signed integers.
217219
#[macro_export]
218220
macro_rules! impl_signed_tests {
219-
{ $vector:ident, $scalar:tt } => {
221+
{ $scalar:tt } => {
220222
mod $scalar {
221-
type Vector<const LANES: usize> = core_simd::$vector<LANES>;
223+
type Vector<const LANES: usize> = core_simd::Simd<Scalar, LANES>;
222224
type Scalar = $scalar;
223225

224226
impl_common_integer_tests! { Vector, Scalar }
@@ -305,28 +307,28 @@ macro_rules! impl_signed_tests {
305307
}
306308
}
307309

308-
impl_binary_op_test!(Vector<LANES>, Scalar, Add::add, AddAssign::add_assign, Scalar::wrapping_add);
309-
impl_binary_op_test!(Vector<LANES>, Scalar, Sub::sub, SubAssign::sub_assign, Scalar::wrapping_sub);
310-
impl_binary_op_test!(Vector<LANES>, Scalar, Mul::mul, MulAssign::mul_assign, Scalar::wrapping_mul);
310+
impl_binary_op_test!(Scalar, Add::add, AddAssign::add_assign, Scalar::wrapping_add);
311+
impl_binary_op_test!(Scalar, Sub::sub, SubAssign::sub_assign, Scalar::wrapping_sub);
312+
impl_binary_op_test!(Scalar, Mul::mul, MulAssign::mul_assign, Scalar::wrapping_mul);
311313

312314
// Exclude Div and Rem panicking cases
313-
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));
314-
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));
315+
impl_binary_checked_op_test!(Scalar, Div::div, DivAssign::div_assign, Scalar::wrapping_div, |x, y| y != 0 && !(x == Scalar::MIN && y == -1));
316+
impl_binary_checked_op_test!(Scalar, Rem::rem, RemAssign::rem_assign, Scalar::wrapping_rem, |x, y| y != 0 && !(x == Scalar::MIN && y == -1));
315317

316-
impl_unary_op_test!(Vector<LANES>, Scalar, Not::not);
317-
impl_binary_op_test!(Vector<LANES>, Scalar, BitAnd::bitand, BitAndAssign::bitand_assign);
318-
impl_binary_op_test!(Vector<LANES>, Scalar, BitOr::bitor, BitOrAssign::bitor_assign);
319-
impl_binary_op_test!(Vector<LANES>, Scalar, BitXor::bitxor, BitXorAssign::bitxor_assign);
318+
impl_unary_op_test!(Scalar, Not::not);
319+
impl_binary_op_test!(Scalar, BitAnd::bitand, BitAndAssign::bitand_assign);
320+
impl_binary_op_test!(Scalar, BitOr::bitor, BitOrAssign::bitor_assign);
321+
impl_binary_op_test!(Scalar, BitXor::bitxor, BitXorAssign::bitxor_assign);
320322
}
321323
}
322324
}
323325

324326
/// Implement tests for unsigned integers.
325327
#[macro_export]
326328
macro_rules! impl_unsigned_tests {
327-
{ $vector:ident, $scalar:tt } => {
329+
{ $scalar:tt } => {
328330
mod $scalar {
329-
type Vector<const LANES: usize> = core_simd::$vector<LANES>;
331+
type Vector<const LANES: usize> = core_simd::Simd<Scalar, LANES>;
330332
type Scalar = $scalar;
331333

332334
impl_common_integer_tests! { Vector, Scalar }
@@ -339,36 +341,36 @@ macro_rules! impl_unsigned_tests {
339341
}
340342
}
341343

342-
impl_binary_op_test!(Vector<LANES>, Scalar, Add::add, AddAssign::add_assign, Scalar::wrapping_add);
343-
impl_binary_op_test!(Vector<LANES>, Scalar, Sub::sub, SubAssign::sub_assign, Scalar::wrapping_sub);
344-
impl_binary_op_test!(Vector<LANES>, Scalar, Mul::mul, MulAssign::mul_assign, Scalar::wrapping_mul);
344+
impl_binary_op_test!(Scalar, Add::add, AddAssign::add_assign, Scalar::wrapping_add);
345+
impl_binary_op_test!(Scalar, Sub::sub, SubAssign::sub_assign, Scalar::wrapping_sub);
346+
impl_binary_op_test!(Scalar, Mul::mul, MulAssign::mul_assign, Scalar::wrapping_mul);
345347

346348
// Exclude Div and Rem panicking cases
347-
impl_binary_checked_op_test!(Vector<LANES>, Scalar, Div::div, DivAssign::div_assign, Scalar::wrapping_div, |_, y| y != 0);
348-
impl_binary_checked_op_test!(Vector<LANES>, Scalar, Rem::rem, RemAssign::rem_assign, Scalar::wrapping_rem, |_, y| y != 0);
349+
impl_binary_checked_op_test!(Scalar, Div::div, DivAssign::div_assign, Scalar::wrapping_div, |_, y| y != 0);
350+
impl_binary_checked_op_test!(Scalar, Rem::rem, RemAssign::rem_assign, Scalar::wrapping_rem, |_, y| y != 0);
349351

350-
impl_unary_op_test!(Vector<LANES>, Scalar, Not::not);
351-
impl_binary_op_test!(Vector<LANES>, Scalar, BitAnd::bitand, BitAndAssign::bitand_assign);
352-
impl_binary_op_test!(Vector<LANES>, Scalar, BitOr::bitor, BitOrAssign::bitor_assign);
353-
impl_binary_op_test!(Vector<LANES>, Scalar, BitXor::bitxor, BitXorAssign::bitxor_assign);
352+
impl_unary_op_test!(Scalar, Not::not);
353+
impl_binary_op_test!(Scalar, BitAnd::bitand, BitAndAssign::bitand_assign);
354+
impl_binary_op_test!(Scalar, BitOr::bitor, BitOrAssign::bitor_assign);
355+
impl_binary_op_test!(Scalar, BitXor::bitxor, BitXorAssign::bitxor_assign);
354356
}
355357
}
356358
}
357359

358360
/// Implement tests for floating point numbers.
359361
#[macro_export]
360362
macro_rules! impl_float_tests {
361-
{ $vector:ident, $scalar:tt, $int_scalar:tt } => {
363+
{ $scalar:tt, $int_scalar:tt } => {
362364
mod $scalar {
363-
type Vector<const LANES: usize> = core_simd::$vector<LANES>;
365+
type Vector<const LANES: usize> = core_simd::Simd<Scalar, LANES>;
364366
type Scalar = $scalar;
365367

366-
impl_unary_op_test!(Vector<LANES>, Scalar, Neg::neg);
367-
impl_binary_op_test!(Vector<LANES>, Scalar, Add::add, AddAssign::add_assign);
368-
impl_binary_op_test!(Vector<LANES>, Scalar, Sub::sub, SubAssign::sub_assign);
369-
impl_binary_op_test!(Vector<LANES>, Scalar, Mul::mul, MulAssign::mul_assign);
370-
impl_binary_op_test!(Vector<LANES>, Scalar, Div::div, DivAssign::div_assign);
371-
impl_binary_op_test!(Vector<LANES>, Scalar, Rem::rem, RemAssign::rem_assign);
368+
impl_unary_op_test!(Scalar, Neg::neg);
369+
impl_binary_op_test!(Scalar, Add::add, AddAssign::add_assign);
370+
impl_binary_op_test!(Scalar, Sub::sub, SubAssign::sub_assign);
371+
impl_binary_op_test!(Scalar, Mul::mul, MulAssign::mul_assign);
372+
impl_binary_op_test!(Scalar, Div::div, DivAssign::div_assign);
373+
impl_binary_op_test!(Scalar, Rem::rem, RemAssign::rem_assign);
372374

373375
test_helpers::test_lanes! {
374376
fn is_sign_positive<const LANES: usize>() {

crates/core_simd/tests/u16_ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
#[macro_use]
44
mod ops_macros;
5-
impl_unsigned_tests! { SimdU16, u16 }
5+
impl_unsigned_tests! { u16 }

crates/core_simd/tests/u32_ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
#[macro_use]
44
mod ops_macros;
5-
impl_unsigned_tests! { SimdU32, u32 }
5+
impl_unsigned_tests! { u32 }

0 commit comments

Comments
 (0)