diff options
| author | Caleb Zulawski <caleb.zulawski@gmail.com> | 2021-02-13 01:11:01 -0500 |
|---|---|---|
| committer | Caleb Zulawski <caleb.zulawski@gmail.com> | 2021-02-15 18:22:56 -0500 |
| commit | 38b18904d0399d8dcfee5dfc94e38d78a8fbba66 (patch) | |
| tree | 3d323c2f53d3b4037b6609da216f1d4d44e88f56 | |
| parent | b38d342d7727287c994aefcaa9b74c87e22e2dab (diff) | |
| download | rust-38b18904d0399d8dcfee5dfc94e38d78a8fbba66.tar.gz rust-38b18904d0399d8dcfee5dfc94e38d78a8fbba66.zip | |
Remove obsolete helpers
| -rw-r--r-- | crates/core_simd/tests/helpers/lanewise.rs | 61 | ||||
| -rw-r--r-- | crates/core_simd/tests/helpers/mod.rs | 2 |
2 files changed, 0 insertions, 63 deletions
diff --git a/crates/core_simd/tests/helpers/lanewise.rs b/crates/core_simd/tests/helpers/lanewise.rs deleted file mode 100644 index 3a9f4796808..00000000000 --- a/crates/core_simd/tests/helpers/lanewise.rs +++ /dev/null @@ -1,61 +0,0 @@ -//! These helpers provide a way to easily emulate a vectorized SIMD op on two SIMD vectors, -//! except using scalar ops that iterate through each lane, one at a time, so as to remove -//! the vagaries of compilation. -//! -//! Do note, however, that when testing that vectorized operations #[should_panic], these -//! "scalarized SIMD ops" will trigger scalar code paths that may also normally panic. - -pub fn apply_unary_lanewise<T1: Copy, T2: Copy, V1: AsRef<[T1]>, V2: AsMut<[T2]> + Default>( - x: V1, - f: impl Fn(T1) -> T2, -) -> V2 { - let mut y = V2::default(); - assert_eq!(x.as_ref().len(), y.as_mut().len()); - for (x, y) in x.as_ref().iter().zip(y.as_mut().iter_mut()) { - *y = f(*x); - } - y -} - -pub fn apply_binary_lanewise<T: Copy, V: AsRef<[T]> + AsMut<[T]> + Default>( - a: V, - b: V, - f: impl Fn(T, T) -> T, -) -> V { - let mut out = V::default(); - let out_slice = out.as_mut(); - let a_slice = a.as_ref(); - let b_slice = b.as_ref(); - for (o, (a, b)) in out_slice.iter_mut().zip(a_slice.iter().zip(b_slice.iter())) { - *o = f(*a, *b); - } - out -} - -pub fn apply_binary_scalar_rhs_lanewise<T: Copy, V: AsRef<[T]> + AsMut<[T]> + Default>( - a: V, - b: T, - f: impl Fn(T, T) -> T, -) -> V { - let mut out = V::default(); - let out_slice = out.as_mut(); - let a_slice = a.as_ref(); - for (o, a) in out_slice.iter_mut().zip(a_slice.iter()) { - *o = f(*a, b); - } - out -} - -pub fn apply_binary_scalar_lhs_lanewise<T: Copy, V: AsRef<[T]> + AsMut<[T]> + Default>( - a: T, - b: V, - f: impl Fn(T, T) -> T, -) -> V { - let mut out = V::default(); - let out_slice = out.as_mut(); - let b_slice = b.as_ref(); - for (o, b) in out_slice.iter_mut().zip(b_slice.iter()) { - *o = f(a, *b); - } - out -} diff --git a/crates/core_simd/tests/helpers/mod.rs b/crates/core_simd/tests/helpers/mod.rs index b128f8251ca..41b4fea9d95 100644 --- a/crates/core_simd/tests/helpers/mod.rs +++ b/crates/core_simd/tests/helpers/mod.rs @@ -1,4 +1,2 @@ #[macro_use] pub mod biteq; - -pub mod lanewise; |
