Skip to content
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

Change Mask element to match Simd element #322

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion crates/core_simd/src/elements/const_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ where
type Usize = Simd<usize, LANES>;
type Isize = Simd<isize, LANES>;
type MutPtr = Simd<*mut T, LANES>;
type Mask = Mask<isize, LANES>;
type Mask = Mask<*const T, LANES>;

#[inline]
fn is_null(self) -> Self::Mask {
Expand Down
13 changes: 6 additions & 7 deletions crates/core_simd/src/elements/float.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use super::sealed::Sealed;
use crate::simd::{
intrinsics, LaneCount, Mask, Simd, SimdElement, SimdPartialEq, SimdPartialOrd,
SupportedLaneCount,
intrinsics, LaneCount, Mask, Simd, SimdPartialEq, SimdPartialOrd, SupportedLaneCount,
};

/// Operations on SIMD vectors of floats.
Expand Down Expand Up @@ -191,7 +190,7 @@ pub trait SimdFloat: Copy + Sealed {
}

macro_rules! impl_trait {
{ $($ty:ty { bits: $bits_ty:ty, mask: $mask_ty:ty }),* } => {
{ $($ty:ty { bits: $bits_ty:ty }),* } => {
$(
impl<const LANES: usize> Sealed for Simd<$ty, LANES>
where
Expand All @@ -203,7 +202,7 @@ macro_rules! impl_trait {
where
LaneCount<LANES>: SupportedLaneCount,
{
type Mask = Mask<<$mask_ty as SimdElement>::Mask, LANES>;
type Mask = Mask<$ty, LANES>;
type Scalar = $ty;
type Bits = Simd<$bits_ty, LANES>;

Expand Down Expand Up @@ -251,7 +250,7 @@ macro_rules! impl_trait {
#[inline]
fn is_sign_negative(self) -> Self::Mask {
let sign_bits = self.to_bits() & Simd::splat((!0 >> 1) + 1);
sign_bits.simd_gt(Simd::splat(0))
sign_bits.simd_gt(Simd::splat(0)).cast()
}

#[inline]
Expand All @@ -271,7 +270,7 @@ macro_rules! impl_trait {

#[inline]
fn is_subnormal(self) -> Self::Mask {
self.abs().simd_ne(Self::splat(0.0)) & (self.to_bits() & Self::splat(Self::Scalar::INFINITY).to_bits()).simd_eq(Simd::splat(0))
self.abs().simd_ne(Self::splat(0.0)) & (self.to_bits() & Self::splat(Self::Scalar::INFINITY).to_bits()).simd_eq(Simd::splat(0)).cast()
}

#[inline]
Expand Down Expand Up @@ -354,4 +353,4 @@ macro_rules! impl_trait {
}
}

impl_trait! { f32 { bits: u32, mask: i32 }, f64 { bits: u64, mask: i64 } }
impl_trait! { f32 { bits: u32 }, f64 { bits: u64 } }
6 changes: 2 additions & 4 deletions crates/core_simd/src/elements/int.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use super::sealed::Sealed;
use crate::simd::{
intrinsics, LaneCount, Mask, Simd, SimdElement, SimdPartialOrd, SupportedLaneCount,
};
use crate::simd::{intrinsics, LaneCount, Mask, Simd, SimdPartialOrd, SupportedLaneCount};

/// Operations on SIMD vectors of signed integers.
pub trait SimdInt: Copy + Sealed {
Expand Down Expand Up @@ -196,7 +194,7 @@ macro_rules! impl_trait {
where
LaneCount<LANES>: SupportedLaneCount,
{
type Mask = Mask<<$ty as SimdElement>::Mask, LANES>;
type Mask = Mask<$ty, LANES>;
type Scalar = $ty;

#[inline]
Expand Down
2 changes: 1 addition & 1 deletion crates/core_simd/src/elements/mut_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ where
type Usize = Simd<usize, LANES>;
type Isize = Simd<isize, LANES>;
type ConstPtr = Simd<*const T, LANES>;
type Mask = Mask<isize, LANES>;
type Mask = Mask<*mut T, LANES>;

#[inline]
fn is_null(self) -> Self::Mask {
Expand Down
16 changes: 8 additions & 8 deletions crates/core_simd/src/eq.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::simd::{
intrinsics, LaneCount, Mask, Simd, SimdConstPtr, SimdElement, SimdMutPtr, SupportedLaneCount,
intrinsics, LaneCount, Mask, Simd, SimdConstPtr, SimdMutPtr, SupportedLaneCount,
};

/// Parallel `PartialEq`.
Expand All @@ -23,7 +23,7 @@ macro_rules! impl_number {
where
LaneCount<LANES>: SupportedLaneCount,
{
type Mask = Mask<<$number as SimdElement>::Mask, LANES>;
type Mask = Mask<$number, LANES>;

#[inline]
fn simd_eq(self, other: Self) -> Self::Mask {
Expand Down Expand Up @@ -78,32 +78,32 @@ impl<T, const LANES: usize> SimdPartialEq for Simd<*const T, LANES>
where
LaneCount<LANES>: SupportedLaneCount,
{
type Mask = Mask<isize, LANES>;
type Mask = Mask<*const T, LANES>;

#[inline]
fn simd_eq(self, other: Self) -> Self::Mask {
self.addr().simd_eq(other.addr())
self.addr().simd_eq(other.addr()).cast()
}

#[inline]
fn simd_ne(self, other: Self) -> Self::Mask {
self.addr().simd_ne(other.addr())
self.addr().simd_ne(other.addr()).cast()
}
}

impl<T, const LANES: usize> SimdPartialEq for Simd<*mut T, LANES>
where
LaneCount<LANES>: SupportedLaneCount,
{
type Mask = Mask<isize, LANES>;
type Mask = Mask<*mut T, LANES>;

#[inline]
fn simd_eq(self, other: Self) -> Self::Mask {
self.addr().simd_eq(other.addr())
self.addr().simd_eq(other.addr()).cast()
}

#[inline]
fn simd_ne(self, other: Self) -> Self::Mask {
self.addr().simd_ne(other.addr())
self.addr().simd_ne(other.addr()).cast()
}
}
Loading