2021-09-18 20:31:49 -05:00
|
|
|
use crate::simd::intrinsics;
|
|
|
|
use crate::simd::{LaneCount, Mask, Simd, SimdElement, SupportedLaneCount};
|
2021-08-07 00:47:54 -05:00
|
|
|
|
2021-08-16 15:38:30 -05:00
|
|
|
impl<T, const LANES: usize> Simd<T, LANES>
|
2021-08-07 00:47:54 -05:00
|
|
|
where
|
2021-08-16 15:38:30 -05:00
|
|
|
T: SimdElement + PartialEq,
|
2021-08-07 00:47:54 -05:00
|
|
|
LaneCount<LANES>: SupportedLaneCount,
|
|
|
|
{
|
|
|
|
/// Test if each lane is equal to the corresponding lane in `other`.
|
|
|
|
#[inline]
|
2021-08-16 15:38:30 -05:00
|
|
|
pub fn lanes_eq(self, other: Self) -> Mask<T::Mask, LANES> {
|
2021-09-18 20:31:49 -05:00
|
|
|
unsafe { Mask::from_int_unchecked(intrinsics::simd_eq(self, other)) }
|
2021-08-07 00:47:54 -05:00
|
|
|
}
|
2021-02-14 22:35:24 -06:00
|
|
|
|
2021-08-07 00:47:54 -05:00
|
|
|
/// Test if each lane is not equal to the corresponding lane in `other`.
|
|
|
|
#[inline]
|
2021-08-16 15:38:30 -05:00
|
|
|
pub fn lanes_ne(self, other: Self) -> Mask<T::Mask, LANES> {
|
2021-09-18 20:31:49 -05:00
|
|
|
unsafe { Mask::from_int_unchecked(intrinsics::simd_ne(self, other)) }
|
2021-02-14 22:35:24 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-16 15:38:30 -05:00
|
|
|
impl<T, const LANES: usize> Simd<T, LANES>
|
2021-08-07 00:47:54 -05:00
|
|
|
where
|
2021-08-16 15:38:30 -05:00
|
|
|
T: SimdElement + PartialOrd,
|
2021-08-07 00:47:54 -05:00
|
|
|
LaneCount<LANES>: SupportedLaneCount,
|
|
|
|
{
|
|
|
|
/// Test if each lane is less than the corresponding lane in `other`.
|
|
|
|
#[inline]
|
2021-08-16 15:38:30 -05:00
|
|
|
pub fn lanes_lt(self, other: Self) -> Mask<T::Mask, LANES> {
|
2021-09-18 20:31:49 -05:00
|
|
|
unsafe { Mask::from_int_unchecked(intrinsics::simd_lt(self, other)) }
|
2021-08-07 00:47:54 -05:00
|
|
|
}
|
2021-02-14 22:35:24 -06:00
|
|
|
|
2021-08-07 00:47:54 -05:00
|
|
|
/// Test if each lane is greater than the corresponding lane in `other`.
|
|
|
|
#[inline]
|
2021-08-16 15:38:30 -05:00
|
|
|
pub fn lanes_gt(self, other: Self) -> Mask<T::Mask, LANES> {
|
2021-09-18 20:31:49 -05:00
|
|
|
unsafe { Mask::from_int_unchecked(intrinsics::simd_gt(self, other)) }
|
2021-08-07 00:47:54 -05:00
|
|
|
}
|
2021-02-14 22:35:24 -06:00
|
|
|
|
2021-08-07 00:47:54 -05:00
|
|
|
/// Test if each lane is less than or equal to the corresponding lane in `other`.
|
|
|
|
#[inline]
|
2021-08-16 15:38:30 -05:00
|
|
|
pub fn lanes_le(self, other: Self) -> Mask<T::Mask, LANES> {
|
2021-09-18 20:31:49 -05:00
|
|
|
unsafe { Mask::from_int_unchecked(intrinsics::simd_le(self, other)) }
|
2021-08-07 00:47:54 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Test if each lane is greater than or equal to the corresponding lane in `other`.
|
|
|
|
#[inline]
|
2021-08-16 15:38:30 -05:00
|
|
|
pub fn lanes_ge(self, other: Self) -> Mask<T::Mask, LANES> {
|
2021-09-18 20:31:49 -05:00
|
|
|
unsafe { Mask::from_int_unchecked(intrinsics::simd_ge(self, other)) }
|
2021-08-07 00:47:54 -05:00
|
|
|
}
|
2021-02-14 22:35:24 -06:00
|
|
|
}
|