Skip to content

use instrinsics for simd equality #209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions crates/core_simd/src/vector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,13 @@ where
impl<T, const LANES: usize> PartialEq for Simd<T, LANES>
where
LaneCount<LANES>: SupportedLaneCount,
T: SimdElement + PartialEq,
T: SimdElement,
{
#[inline]
fn eq(&self, other: &Self) -> bool {
// TODO use SIMD equality
self.to_array() == other.to_array()
unsafe {
intrinsics::simd_reduce_all(intrinsics::simd_eq::<Self, Simd<u8, LANES>>(*self, *other))
}
}
}

Expand All @@ -346,7 +347,7 @@ where
{
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
// TODO use SIMD equality
// TODO: use SIMD comparsion
self.to_array().partial_cmp(other.as_ref())
}
}
Expand All @@ -365,7 +366,7 @@ where
{
#[inline]
fn cmp(&self, other: &Self) -> core::cmp::Ordering {
// TODO use SIMD equality
// TODO: use SIMD comparsion
self.to_array().cmp(other.as_ref())
}
}
Expand Down