Reduce maximum lanes from 64 to 32

This commit is contained in:
Caleb Zulawski 2021-04-03 14:43:33 -04:00
parent 97bbe2d86a
commit e6a530907a
18 changed files with 212 additions and 228 deletions

View File

@ -1,12 +1,12 @@
use crate::LanesAtMost64;
use crate::LanesAtMost32;
macro_rules! implement_mask_ops {
{ $($vector:ident => $mask:ident ($inner_mask_ty:ident, $inner_ty:ident),)* } => {
$(
impl<const LANES: usize> crate::$vector<LANES>
where
crate::$vector<LANES>: LanesAtMost64,
crate::$inner_ty<LANES>: LanesAtMost64,
crate::$vector<LANES>: LanesAtMost32,
crate::$inner_ty<LANES>: LanesAtMost32,
{
/// Test if each lane is equal to the corresponding lane in `other`.
#[inline]

View File

@ -1,7 +1,7 @@
/// Implements common traits on the specified vector `$name`, holding multiple `$lanes` of `$type`.
macro_rules! impl_vector {
{ $name:ident, $type:ty } => {
impl<const LANES: usize> $name<LANES> where Self: crate::LanesAtMost64 {
impl<const LANES: usize> $name<LANES> where Self: crate::LanesAtMost32 {
/// Construct a SIMD vector by setting all lanes to the given value.
pub const fn splat(value: $type) -> Self {
Self([value; LANES])
@ -44,23 +44,23 @@ macro_rules! impl_vector {
}
}
impl<const LANES: usize> Copy for $name<LANES> where Self: crate::LanesAtMost64 {}
impl<const LANES: usize> Copy for $name<LANES> where Self: crate::LanesAtMost32 {}
impl<const LANES: usize> Clone for $name<LANES> where Self: crate::LanesAtMost64 {
impl<const LANES: usize> Clone for $name<LANES> where Self: crate::LanesAtMost32 {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<const LANES: usize> Default for $name<LANES> where Self: crate::LanesAtMost64 {
impl<const LANES: usize> Default for $name<LANES> where Self: crate::LanesAtMost32 {
#[inline]
fn default() -> Self {
Self::splat(<$type>::default())
}
}
impl<const LANES: usize> PartialEq for $name<LANES> where Self: crate::LanesAtMost64 {
impl<const LANES: usize> PartialEq for $name<LANES> where Self: crate::LanesAtMost32 {
#[inline]
fn eq(&self, other: &Self) -> bool {
// TODO use SIMD equality
@ -68,7 +68,7 @@ macro_rules! impl_vector {
}
}
impl<const LANES: usize> PartialOrd for $name<LANES> where Self: crate::LanesAtMost64 {
impl<const LANES: usize> PartialOrd for $name<LANES> where Self: crate::LanesAtMost32 {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
// TODO use SIMD equalitya
@ -77,14 +77,14 @@ macro_rules! impl_vector {
}
// array references
impl<const LANES: usize> AsRef<[$type; LANES]> for $name<LANES> where Self: crate::LanesAtMost64 {
impl<const LANES: usize> AsRef<[$type; LANES]> for $name<LANES> where Self: crate::LanesAtMost32 {
#[inline]
fn as_ref(&self) -> &[$type; LANES] {
&self.0
}
}
impl<const LANES: usize> AsMut<[$type; LANES]> for $name<LANES> where Self: crate::LanesAtMost64 {
impl<const LANES: usize> AsMut<[$type; LANES]> for $name<LANES> where Self: crate::LanesAtMost32 {
#[inline]
fn as_mut(&mut self) -> &mut [$type; LANES] {
&mut self.0
@ -92,14 +92,14 @@ macro_rules! impl_vector {
}
// slice references
impl<const LANES: usize> AsRef<[$type]> for $name<LANES> where Self: crate::LanesAtMost64 {
impl<const LANES: usize> AsRef<[$type]> for $name<LANES> where Self: crate::LanesAtMost32 {
#[inline]
fn as_ref(&self) -> &[$type] {
&self.0
}
}
impl<const LANES: usize> AsMut<[$type]> for $name<LANES> where Self: crate::LanesAtMost64 {
impl<const LANES: usize> AsMut<[$type]> for $name<LANES> where Self: crate::LanesAtMost32 {
#[inline]
fn as_mut(&mut self) -> &mut [$type] {
&mut self.0
@ -107,13 +107,13 @@ macro_rules! impl_vector {
}
// vector/array conversion
impl<const LANES: usize> From<[$type; LANES]> for $name<LANES> where Self: crate::LanesAtMost64 {
impl<const LANES: usize> From<[$type; LANES]> for $name<LANES> where Self: crate::LanesAtMost32 {
fn from(array: [$type; LANES]) -> Self {
Self(array)
}
}
impl <const LANES: usize> From<$name<LANES>> for [$type; LANES] where $name<LANES>: crate::LanesAtMost64 {
impl <const LANES: usize> From<$name<LANES>> for [$type; LANES] where $name<LANES>: crate::LanesAtMost32 {
fn from(vector: $name<LANES>) -> Self {
vector.to_array()
}

View File

@ -35,7 +35,7 @@ macro_rules! impl_fmt_trait {
$( // repeat trait
impl<const LANES: usize> core::fmt::$trait for crate::$type<LANES>
where
Self: crate::LanesAtMost64,
Self: crate::LanesAtMost32,
{
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
$format(self.as_ref(), f)

View File

@ -61,7 +61,6 @@ extern "platform-intrinsic" {
pub(crate) fn simd_shuffle8<T, U>(x: T, y: T, idx: [u32; 8]) -> U;
pub(crate) fn simd_shuffle16<T, U>(x: T, y: T, idx: [u32; 16]) -> U;
pub(crate) fn simd_shuffle32<T, U>(x: T, y: T, idx: [u32; 32]) -> U;
pub(crate) fn simd_shuffle64<T, U>(x: T, y: T, idx: [u32; 64]) -> U;
// {s,u}add.sat
pub(crate) fn simd_saturating_add<T>(x: T, y: T) -> T;

View File

@ -1,15 +1,14 @@
/// Implemented for bitmask sizes that are supported by the implementation.
pub trait LanesAtMost64 {}
pub trait LanesAtMost32 {}
macro_rules! impl_for {
{ $name:ident } => {
impl LanesAtMost64 for $name<1> {}
impl LanesAtMost64 for $name<2> {}
impl LanesAtMost64 for $name<4> {}
impl LanesAtMost64 for $name<8> {}
impl LanesAtMost64 for $name<16> {}
impl LanesAtMost64 for $name<32> {}
impl LanesAtMost64 for $name<64> {}
impl LanesAtMost32 for $name<1> {}
impl LanesAtMost32 for $name<2> {}
impl LanesAtMost32 for $name<4> {}
impl LanesAtMost32 for $name<8> {}
impl LanesAtMost32 for $name<16> {}
impl LanesAtMost32 for $name<32> {}
}
}

View File

@ -21,7 +21,7 @@ mod round;
mod math;
mod lanes_at_most_64;
pub use lanes_at_most_64::LanesAtMost64;
pub use lanes_at_most_64::LanesAtMost32;
mod masks;
pub use masks::*;

View File

@ -1,15 +1,15 @@
use crate::LanesAtMost64;
use crate::LanesAtMost32;
/// A mask where each lane is represented by a single bit.
#[derive(Copy, Clone, Debug)]
#[repr(transparent)]
pub struct BitMask<const LANES: usize>(u64)
where
BitMask<LANES>: LanesAtMost64;
BitMask<LANES>: LanesAtMost32;
impl<const LANES: usize> BitMask<LANES>
where
Self: LanesAtMost64,
Self: LanesAtMost32,
{
/// Construct a mask by setting all lanes to the given value.
pub fn splat(value: bool) -> Self {
@ -43,7 +43,7 @@ where
impl<const LANES: usize> core::ops::BitAnd for BitMask<LANES>
where
Self: LanesAtMost64,
Self: LanesAtMost32,
{
type Output = Self;
#[inline]
@ -54,7 +54,7 @@ where
impl<const LANES: usize> core::ops::BitAnd<bool> for BitMask<LANES>
where
Self: LanesAtMost64,
Self: LanesAtMost32,
{
type Output = Self;
#[inline]
@ -65,7 +65,7 @@ where
impl<const LANES: usize> core::ops::BitAnd<BitMask<LANES>> for bool
where
BitMask<LANES>: LanesAtMost64,
BitMask<LANES>: LanesAtMost32,
{
type Output = BitMask<LANES>;
#[inline]
@ -76,7 +76,7 @@ where
impl<const LANES: usize> core::ops::BitOr for BitMask<LANES>
where
Self: LanesAtMost64,
Self: LanesAtMost32,
{
type Output = Self;
#[inline]
@ -87,7 +87,7 @@ where
impl<const LANES: usize> core::ops::BitOr<bool> for BitMask<LANES>
where
Self: LanesAtMost64,
Self: LanesAtMost32,
{
type Output = Self;
#[inline]
@ -98,7 +98,7 @@ where
impl<const LANES: usize> core::ops::BitOr<BitMask<LANES>> for bool
where
BitMask<LANES>: LanesAtMost64,
BitMask<LANES>: LanesAtMost32,
{
type Output = BitMask<LANES>;
#[inline]
@ -109,7 +109,7 @@ where
impl<const LANES: usize> core::ops::BitXor for BitMask<LANES>
where
Self: LanesAtMost64,
Self: LanesAtMost32,
{
type Output = Self;
#[inline]
@ -120,7 +120,7 @@ where
impl<const LANES: usize> core::ops::BitXor<bool> for BitMask<LANES>
where
Self: LanesAtMost64,
Self: LanesAtMost32,
{
type Output = Self;
#[inline]
@ -131,7 +131,7 @@ where
impl<const LANES: usize> core::ops::BitXor<BitMask<LANES>> for bool
where
BitMask<LANES>: LanesAtMost64,
BitMask<LANES>: LanesAtMost32,
{
type Output = BitMask<LANES>;
#[inline]
@ -142,7 +142,7 @@ where
impl<const LANES: usize> core::ops::Not for BitMask<LANES>
where
Self: LanesAtMost64,
Self: LanesAtMost32,
{
type Output = BitMask<LANES>;
#[inline]
@ -153,7 +153,7 @@ where
impl<const LANES: usize> core::ops::BitAndAssign for BitMask<LANES>
where
Self: LanesAtMost64,
Self: LanesAtMost32,
{
#[inline]
fn bitand_assign(&mut self, rhs: Self) {
@ -163,7 +163,7 @@ where
impl<const LANES: usize> core::ops::BitAndAssign<bool> for BitMask<LANES>
where
Self: LanesAtMost64,
Self: LanesAtMost32,
{
#[inline]
fn bitand_assign(&mut self, rhs: bool) {
@ -173,7 +173,7 @@ where
impl<const LANES: usize> core::ops::BitOrAssign for BitMask<LANES>
where
Self: LanesAtMost64,
Self: LanesAtMost32,
{
#[inline]
fn bitor_assign(&mut self, rhs: Self) {
@ -183,7 +183,7 @@ where
impl<const LANES: usize> core::ops::BitOrAssign<bool> for BitMask<LANES>
where
Self: LanesAtMost64,
Self: LanesAtMost32,
{
#[inline]
fn bitor_assign(&mut self, rhs: bool) {
@ -193,7 +193,7 @@ where
impl<const LANES: usize> core::ops::BitXorAssign for BitMask<LANES>
where
Self: LanesAtMost64,
Self: LanesAtMost32,
{
#[inline]
fn bitxor_assign(&mut self, rhs: Self) {
@ -203,7 +203,7 @@ where
impl<const LANES: usize> core::ops::BitXorAssign<bool> for BitMask<LANES>
where
Self: LanesAtMost64,
Self: LanesAtMost32,
{
#[inline]
fn bitxor_assign(&mut self, rhs: bool) {

View File

@ -20,16 +20,16 @@ macro_rules! define_mask {
#[repr(transparent)]
pub struct $name<const $lanes: usize>($type)
where
$type: crate::LanesAtMost64;
$type: crate::LanesAtMost32;
impl<const LANES: usize> Copy for $name<LANES>
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{}
impl<const LANES: usize> Clone for $name<LANES>
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{
#[inline]
fn clone(&self) -> Self {
@ -39,7 +39,7 @@ macro_rules! define_mask {
impl<const $lanes: usize> $name<$lanes>
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{
/// Construct a mask by setting all lanes to the given value.
pub fn splat(value: bool) -> Self {
@ -98,7 +98,7 @@ macro_rules! define_mask {
impl<const $lanes: usize> core::convert::From<bool> for $name<$lanes>
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{
fn from(value: bool) -> Self {
Self::splat(value)
@ -107,7 +107,7 @@ macro_rules! define_mask {
impl<const $lanes: usize> core::convert::TryFrom<$type> for $name<$lanes>
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{
type Error = TryFromMaskError;
fn try_from(value: $type) -> Result<Self, Self::Error> {
@ -121,7 +121,7 @@ macro_rules! define_mask {
impl<const $lanes: usize> core::convert::From<$name<$lanes>> for $type
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{
fn from(value: $name<$lanes>) -> Self {
value.0
@ -130,8 +130,8 @@ macro_rules! define_mask {
impl<const $lanes: usize> core::convert::From<crate::BitMask<$lanes>> for $name<$lanes>
where
$type: crate::LanesAtMost64,
crate::BitMask<$lanes>: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
crate::BitMask<$lanes>: crate::LanesAtMost32,
{
fn from(value: crate::BitMask<$lanes>) -> Self {
// TODO use an intrinsic to do this efficiently (with LLVM's sext instruction)
@ -145,8 +145,8 @@ macro_rules! define_mask {
impl<const $lanes: usize> core::convert::From<$name<$lanes>> for crate::BitMask<$lanes>
where
$type: crate::LanesAtMost64,
crate::BitMask<$lanes>: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
crate::BitMask<$lanes>: crate::LanesAtMost32,
{
fn from(value: $name<$lanes>) -> Self {
// TODO use an intrinsic to do this efficiently (with LLVM's trunc instruction)
@ -160,7 +160,7 @@ macro_rules! define_mask {
impl<const $lanes: usize> core::fmt::Debug for $name<$lanes>
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_list()
@ -171,7 +171,7 @@ macro_rules! define_mask {
impl<const $lanes: usize> core::fmt::Binary for $name<$lanes>
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
core::fmt::Binary::fmt(&self.0, f)
@ -180,7 +180,7 @@ macro_rules! define_mask {
impl<const $lanes: usize> core::fmt::Octal for $name<$lanes>
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
core::fmt::Octal::fmt(&self.0, f)
@ -189,7 +189,7 @@ macro_rules! define_mask {
impl<const $lanes: usize> core::fmt::LowerHex for $name<$lanes>
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
core::fmt::LowerHex::fmt(&self.0, f)
@ -198,7 +198,7 @@ macro_rules! define_mask {
impl<const $lanes: usize> core::fmt::UpperHex for $name<$lanes>
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
core::fmt::UpperHex::fmt(&self.0, f)
@ -207,7 +207,7 @@ macro_rules! define_mask {
impl<const LANES: usize> core::ops::BitAnd for $name<LANES>
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{
type Output = Self;
#[inline]
@ -218,7 +218,7 @@ macro_rules! define_mask {
impl<const LANES: usize> core::ops::BitAnd<bool> for $name<LANES>
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{
type Output = Self;
#[inline]
@ -229,7 +229,7 @@ macro_rules! define_mask {
impl<const LANES: usize> core::ops::BitAnd<$name<LANES>> for bool
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{
type Output = $name<LANES>;
#[inline]
@ -240,7 +240,7 @@ macro_rules! define_mask {
impl<const LANES: usize> core::ops::BitOr for $name<LANES>
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{
type Output = Self;
#[inline]
@ -251,7 +251,7 @@ macro_rules! define_mask {
impl<const LANES: usize> core::ops::BitOr<bool> for $name<LANES>
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{
type Output = Self;
#[inline]
@ -262,7 +262,7 @@ macro_rules! define_mask {
impl<const LANES: usize> core::ops::BitOr<$name<LANES>> for bool
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{
type Output = $name<LANES>;
#[inline]
@ -273,7 +273,7 @@ macro_rules! define_mask {
impl<const LANES: usize> core::ops::BitXor for $name<LANES>
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{
type Output = Self;
#[inline]
@ -284,7 +284,7 @@ macro_rules! define_mask {
impl<const LANES: usize> core::ops::BitXor<bool> for $name<LANES>
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{
type Output = Self;
#[inline]
@ -295,7 +295,7 @@ macro_rules! define_mask {
impl<const LANES: usize> core::ops::BitXor<$name<LANES>> for bool
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{
type Output = $name<LANES>;
#[inline]
@ -306,7 +306,7 @@ macro_rules! define_mask {
impl<const LANES: usize> core::ops::Not for $name<LANES>
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{
type Output = $name<LANES>;
#[inline]
@ -317,7 +317,7 @@ macro_rules! define_mask {
impl<const LANES: usize> core::ops::BitAndAssign for $name<LANES>
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{
#[inline]
fn bitand_assign(&mut self, rhs: Self) {
@ -327,7 +327,7 @@ macro_rules! define_mask {
impl<const LANES: usize> core::ops::BitAndAssign<bool> for $name<LANES>
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{
#[inline]
fn bitand_assign(&mut self, rhs: bool) {
@ -337,7 +337,7 @@ macro_rules! define_mask {
impl<const LANES: usize> core::ops::BitOrAssign for $name<LANES>
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{
#[inline]
fn bitor_assign(&mut self, rhs: Self) {
@ -347,7 +347,7 @@ macro_rules! define_mask {
impl<const LANES: usize> core::ops::BitOrAssign<bool> for $name<LANES>
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{
#[inline]
fn bitor_assign(&mut self, rhs: bool) {
@ -357,7 +357,7 @@ macro_rules! define_mask {
impl<const LANES: usize> core::ops::BitXorAssign for $name<LANES>
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{
#[inline]
fn bitxor_assign(&mut self, rhs: Self) {
@ -367,7 +367,7 @@ macro_rules! define_mask {
impl<const LANES: usize> core::ops::BitXorAssign<bool> for $name<LANES>
where
$type: crate::LanesAtMost64,
$type: crate::LanesAtMost32,
{
#[inline]
fn bitxor_assign(&mut self, rhs: bool) {

View File

@ -7,7 +7,7 @@ pub use full_masks::*;
mod bitmask;
pub use bitmask::*;
use crate::LanesAtMost64;
use crate::LanesAtMost32;
macro_rules! define_opaque_mask {
{
@ -17,11 +17,11 @@ macro_rules! define_opaque_mask {
} => {
$(#[$attr])*
#[allow(non_camel_case_types)]
pub struct $name<const $lanes: usize>($inner_ty) where $bits_ty: LanesAtMost64;
pub struct $name<const $lanes: usize>($inner_ty) where $bits_ty: LanesAtMost32;
impl<const $lanes: usize> $name<$lanes>
where
$bits_ty: LanesAtMost64
$bits_ty: LanesAtMost32
{
/// Construct a mask by setting all lanes to the given value.
pub fn splat(value: bool) -> Self {
@ -71,8 +71,8 @@ macro_rules! define_opaque_mask {
impl<const $lanes: usize> From<BitMask<$lanes>> for $name<$lanes>
where
$bits_ty: LanesAtMost64,
BitMask<$lanes>: LanesAtMost64,
$bits_ty: LanesAtMost32,
BitMask<$lanes>: LanesAtMost32,
{
fn from(value: BitMask<$lanes>) -> Self {
Self(value.into())
@ -81,8 +81,8 @@ macro_rules! define_opaque_mask {
impl<const $lanes: usize> From<$name<$lanes>> for crate::BitMask<$lanes>
where
$bits_ty: LanesAtMost64,
BitMask<$lanes>: LanesAtMost64,
$bits_ty: LanesAtMost32,
BitMask<$lanes>: LanesAtMost32,
{
fn from(value: $name<$lanes>) -> Self {
value.0.into()
@ -91,7 +91,7 @@ macro_rules! define_opaque_mask {
impl<const $lanes: usize> From<$inner_ty> for $name<$lanes>
where
$bits_ty: LanesAtMost64,
$bits_ty: LanesAtMost32,
{
fn from(value: $inner_ty) -> Self {
Self(value)
@ -100,7 +100,7 @@ macro_rules! define_opaque_mask {
impl<const $lanes: usize> From<$name<$lanes>> for $inner_ty
where
$bits_ty: LanesAtMost64,
$bits_ty: LanesAtMost32,
{
fn from(value: $name<$lanes>) -> Self {
value.0
@ -108,13 +108,13 @@ macro_rules! define_opaque_mask {
}
// vector/array conversion
impl<const $lanes: usize> From<[bool; $lanes]> for $name<$lanes> where $bits_ty: crate::LanesAtMost64 {
impl<const $lanes: usize> From<[bool; $lanes]> for $name<$lanes> where $bits_ty: crate::LanesAtMost32 {
fn from(array: [bool; $lanes]) -> Self {
Self::from_array(array)
}
}
impl <const $lanes: usize> From<$name<$lanes>> for [bool; $lanes] where $bits_ty: crate::LanesAtMost64 {
impl <const $lanes: usize> From<$name<$lanes>> for [bool; $lanes] where $bits_ty: crate::LanesAtMost32 {
fn from(vector: $name<$lanes>) -> Self {
vector.to_array()
}
@ -123,12 +123,12 @@ macro_rules! define_opaque_mask {
impl<const $lanes: usize> Copy for $name<$lanes>
where
$inner_ty: Copy,
$bits_ty: LanesAtMost64,
$bits_ty: LanesAtMost32,
{}
impl<const $lanes: usize> Clone for $name<$lanes>
where
$bits_ty: LanesAtMost64,
$bits_ty: LanesAtMost32,
{
#[inline]
fn clone(&self) -> Self {
@ -138,7 +138,7 @@ macro_rules! define_opaque_mask {
impl<const $lanes: usize> Default for $name<$lanes>
where
$bits_ty: LanesAtMost64,
$bits_ty: LanesAtMost32,
{
#[inline]
fn default() -> Self {
@ -148,7 +148,7 @@ macro_rules! define_opaque_mask {
impl<const $lanes: usize> PartialEq for $name<$lanes>
where
$bits_ty: LanesAtMost64,
$bits_ty: LanesAtMost32,
{
#[inline]
fn eq(&self, other: &Self) -> bool {
@ -158,7 +158,7 @@ macro_rules! define_opaque_mask {
impl<const $lanes: usize> PartialOrd for $name<$lanes>
where
$bits_ty: LanesAtMost64,
$bits_ty: LanesAtMost32,
{
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
@ -168,7 +168,7 @@ macro_rules! define_opaque_mask {
impl<const $lanes: usize> core::fmt::Debug for $name<$lanes>
where
$bits_ty: LanesAtMost64,
$bits_ty: LanesAtMost32,
{
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
core::fmt::Debug::fmt(&self.0, f)
@ -177,7 +177,7 @@ macro_rules! define_opaque_mask {
impl<const LANES: usize> core::ops::BitAnd for $name<LANES>
where
$bits_ty: LanesAtMost64,
$bits_ty: LanesAtMost32,
{
type Output = Self;
#[inline]
@ -188,7 +188,7 @@ macro_rules! define_opaque_mask {
impl<const LANES: usize> core::ops::BitAnd<bool> for $name<LANES>
where
$bits_ty: LanesAtMost64,
$bits_ty: LanesAtMost32,
{
type Output = Self;
#[inline]
@ -199,7 +199,7 @@ macro_rules! define_opaque_mask {
impl<const LANES: usize> core::ops::BitAnd<$name<LANES>> for bool
where
$bits_ty: LanesAtMost64,
$bits_ty: LanesAtMost32,
{
type Output = $name<LANES>;
#[inline]
@ -210,7 +210,7 @@ macro_rules! define_opaque_mask {
impl<const LANES: usize> core::ops::BitOr for $name<LANES>
where
$bits_ty: LanesAtMost64,
$bits_ty: LanesAtMost32,
{
type Output = Self;
#[inline]
@ -221,7 +221,7 @@ macro_rules! define_opaque_mask {
impl<const LANES: usize> core::ops::BitOr<bool> for $name<LANES>
where
$bits_ty: LanesAtMost64,
$bits_ty: LanesAtMost32,
{
type Output = Self;
#[inline]
@ -232,7 +232,7 @@ macro_rules! define_opaque_mask {
impl<const LANES: usize> core::ops::BitOr<$name<LANES>> for bool
where
$bits_ty: LanesAtMost64,
$bits_ty: LanesAtMost32,
{
type Output = $name<LANES>;
#[inline]
@ -243,7 +243,7 @@ macro_rules! define_opaque_mask {
impl<const LANES: usize> core::ops::BitXor for $name<LANES>
where
$bits_ty: LanesAtMost64,
$bits_ty: LanesAtMost32,
{
type Output = Self;
#[inline]
@ -254,7 +254,7 @@ macro_rules! define_opaque_mask {
impl<const LANES: usize> core::ops::BitXor<bool> for $name<LANES>
where
$bits_ty: LanesAtMost64,
$bits_ty: LanesAtMost32,
{
type Output = Self;
#[inline]
@ -265,7 +265,7 @@ macro_rules! define_opaque_mask {
impl<const LANES: usize> core::ops::BitXor<$name<LANES>> for bool
where
$bits_ty: LanesAtMost64,
$bits_ty: LanesAtMost32,
{
type Output = $name<LANES>;
#[inline]
@ -276,7 +276,7 @@ macro_rules! define_opaque_mask {
impl<const LANES: usize> core::ops::Not for $name<LANES>
where
$bits_ty: LanesAtMost64,
$bits_ty: LanesAtMost32,
{
type Output = $name<LANES>;
#[inline]
@ -287,7 +287,7 @@ macro_rules! define_opaque_mask {
impl<const LANES: usize> core::ops::BitAndAssign for $name<LANES>
where
$bits_ty: LanesAtMost64,
$bits_ty: LanesAtMost32,
{
#[inline]
fn bitand_assign(&mut self, rhs: Self) {
@ -297,7 +297,7 @@ macro_rules! define_opaque_mask {
impl<const LANES: usize> core::ops::BitAndAssign<bool> for $name<LANES>
where
$bits_ty: LanesAtMost64,
$bits_ty: LanesAtMost32,
{
#[inline]
fn bitand_assign(&mut self, rhs: bool) {
@ -307,7 +307,7 @@ macro_rules! define_opaque_mask {
impl<const LANES: usize> core::ops::BitOrAssign for $name<LANES>
where
$bits_ty: LanesAtMost64,
$bits_ty: LanesAtMost32,
{
#[inline]
fn bitor_assign(&mut self, rhs: Self) {
@ -317,7 +317,7 @@ macro_rules! define_opaque_mask {
impl<const LANES: usize> core::ops::BitOrAssign<bool> for $name<LANES>
where
$bits_ty: LanesAtMost64,
$bits_ty: LanesAtMost32,
{
#[inline]
fn bitor_assign(&mut self, rhs: bool) {
@ -327,7 +327,7 @@ macro_rules! define_opaque_mask {
impl<const LANES: usize> core::ops::BitXorAssign for $name<LANES>
where
$bits_ty: LanesAtMost64,
$bits_ty: LanesAtMost32,
{
#[inline]
fn bitxor_assign(&mut self, rhs: Self) {
@ -337,7 +337,7 @@ macro_rules! define_opaque_mask {
impl<const LANES: usize> core::ops::BitXorAssign<bool> for $name<LANES>
where
$bits_ty: LanesAtMost64,
$bits_ty: LanesAtMost32,
{
#[inline]
fn bitxor_assign(&mut self, rhs: bool) {

View File

@ -1,6 +1,6 @@
macro_rules! impl_uint_arith {
($(($name:ident, $n:ty)),+) => {
$( impl<const LANES: usize> $name<LANES> where Self: crate::LanesAtMost64 {
$( impl<const LANES: usize> $name<LANES> where Self: crate::LanesAtMost32 {
/// Lanewise saturating add.
///
@ -42,7 +42,7 @@ macro_rules! impl_uint_arith {
macro_rules! impl_int_arith {
($(($name:ident, $n:ty)),+) => {
$( impl<const LANES: usize> $name<LANES> where Self: crate::LanesAtMost64 {
$( impl<const LANES: usize> $name<LANES> where Self: crate::LanesAtMost32 {
/// Lanewise saturating add.
///

View File

@ -1,4 +1,4 @@
use crate::LanesAtMost64;
use crate::LanesAtMost32;
/// Checks if the right-hand side argument of a left- or right-shift would cause overflow.
fn invalid_shift_rhs<T>(rhs: T) -> bool
@ -16,7 +16,7 @@ macro_rules! impl_ref_ops {
{
impl<const $lanes:ident: usize> core::ops::$trait:ident<$rhs:ty> for $type:ty
where
$($bound:path: LanesAtMost64,)*
$($bound:path: LanesAtMost32,)*
{
type Output = $output:ty;
@ -26,7 +26,7 @@ macro_rules! impl_ref_ops {
} => {
impl<const $lanes: usize> core::ops::$trait<$rhs> for $type
where
$($bound: LanesAtMost64,)*
$($bound: LanesAtMost32,)*
{
type Output = $output;
@ -36,7 +36,7 @@ macro_rules! impl_ref_ops {
impl<const $lanes: usize> core::ops::$trait<&'_ $rhs> for $type
where
$($bound: LanesAtMost64,)*
$($bound: LanesAtMost32,)*
{
type Output = <$type as core::ops::$trait<$rhs>>::Output;
@ -48,7 +48,7 @@ macro_rules! impl_ref_ops {
impl<const $lanes: usize> core::ops::$trait<$rhs> for &'_ $type
where
$($bound: LanesAtMost64,)*
$($bound: LanesAtMost32,)*
{
type Output = <$type as core::ops::$trait<$rhs>>::Output;
@ -60,7 +60,7 @@ macro_rules! impl_ref_ops {
impl<const $lanes: usize> core::ops::$trait<&'_ $rhs> for &'_ $type
where
$($bound: LanesAtMost64,)*
$($bound: LanesAtMost32,)*
{
type Output = <$type as core::ops::$trait<$rhs>>::Output;
@ -75,7 +75,7 @@ macro_rules! impl_ref_ops {
{
impl<const $lanes:ident: usize> core::ops::$trait:ident<$rhs:ty> for $type:ty
where
$($bound:path: LanesAtMost64,)*
$($bound:path: LanesAtMost32,)*
{
$(#[$attrs:meta])*
fn $fn:ident(&mut $self_tok:ident, $rhs_arg:ident: $rhs_arg_ty:ty) $body:tt
@ -83,7 +83,7 @@ macro_rules! impl_ref_ops {
} => {
impl<const $lanes: usize> core::ops::$trait<$rhs> for $type
where
$($bound: LanesAtMost64,)*
$($bound: LanesAtMost32,)*
{
$(#[$attrs])*
fn $fn(&mut $self_tok, $rhs_arg: $rhs_arg_ty) $body
@ -91,7 +91,7 @@ macro_rules! impl_ref_ops {
impl<const $lanes: usize> core::ops::$trait<&'_ $rhs> for $type
where
$($bound: LanesAtMost64,)*
$($bound: LanesAtMost32,)*
{
$(#[$attrs])*
fn $fn(&mut $self_tok, $rhs_arg: &$rhs_arg_ty) {
@ -104,7 +104,7 @@ macro_rules! impl_ref_ops {
{
impl<const $lanes:ident: usize> core::ops::$trait:ident for $type:ty
where
$($bound:path: LanesAtMost64,)*
$($bound:path: LanesAtMost32,)*
{
type Output = $output:ty;
fn $fn:ident($self_tok:ident) -> Self::Output $body:tt
@ -112,7 +112,7 @@ macro_rules! impl_ref_ops {
} => {
impl<const $lanes: usize> core::ops::$trait for $type
where
$($bound: LanesAtMost64,)*
$($bound: LanesAtMost32,)*
{
type Output = $output;
fn $fn($self_tok) -> Self::Output $body
@ -120,7 +120,7 @@ macro_rules! impl_ref_ops {
impl<const $lanes: usize> core::ops::$trait for &'_ $type
where
$($bound: LanesAtMost64,)*
$($bound: LanesAtMost32,)*
{
type Output = <$type as core::ops::$trait>::Output;
fn $fn($self_tok) -> Self::Output {
@ -167,7 +167,7 @@ macro_rules! impl_op {
impl_ref_ops! {
impl<const LANES: usize> core::ops::Not for crate::$type<LANES>
where
crate::$type<LANES>: LanesAtMost64,
crate::$type<LANES>: LanesAtMost32,
{
type Output = Self;
fn not(self) -> Self::Output {
@ -181,7 +181,7 @@ macro_rules! impl_op {
impl_ref_ops! {
impl<const LANES: usize> core::ops::Neg for crate::$type<LANES>
where
crate::$type<LANES>: LanesAtMost64,
crate::$type<LANES>: LanesAtMost32,
{
type Output = Self;
fn neg(self) -> Self::Output {
@ -195,9 +195,9 @@ macro_rules! impl_op {
impl_ref_ops! {
impl<const LANES: usize> core::ops::Neg for crate::$type<LANES>
where
crate::$type<LANES>: LanesAtMost64,
crate::SimdU32<LANES>: LanesAtMost64,
crate::SimdU64<LANES>: LanesAtMost64,
crate::$type<LANES>: LanesAtMost32,
crate::SimdU32<LANES>: LanesAtMost32,
crate::SimdU64<LANES>: LanesAtMost32,
{
type Output = Self;
fn neg(self) -> Self::Output {
@ -212,7 +212,7 @@ macro_rules! impl_op {
{ impl Index for $type:ident, $scalar:ty } => {
impl<I, const LANES: usize> core::ops::Index<I> for crate::$type<LANES>
where
Self: LanesAtMost64,
Self: LanesAtMost32,
I: core::slice::SliceIndex<[$scalar]>,
{
type Output = I::Output;
@ -224,7 +224,7 @@ macro_rules! impl_op {
impl<I, const LANES: usize> core::ops::IndexMut<I> for crate::$type<LANES>
where
Self: LanesAtMost64,
Self: LanesAtMost32,
I: core::slice::SliceIndex<[$scalar]>,
{
fn index_mut(&mut self, index: I) -> &mut Self::Output {
@ -239,7 +239,7 @@ macro_rules! impl_op {
impl_ref_ops! {
impl<const LANES: usize> core::ops::$trait<Self> for crate::$type<LANES>
where
crate::$type<LANES>: LanesAtMost64,
crate::$type<LANES>: LanesAtMost32,
{
type Output = Self;
@ -255,7 +255,7 @@ macro_rules! impl_op {
impl_ref_ops! {
impl<const LANES: usize> core::ops::$trait<$scalar> for crate::$type<LANES>
where
crate::$type<LANES>: LanesAtMost64,
crate::$type<LANES>: LanesAtMost32,
{
type Output = Self;
@ -269,7 +269,7 @@ macro_rules! impl_op {
impl_ref_ops! {
impl<const LANES: usize> core::ops::$trait<crate::$type<LANES>> for $scalar
where
crate::$type<LANES>: LanesAtMost64,
crate::$type<LANES>: LanesAtMost32,
{
type Output = crate::$type<LANES>;
@ -283,7 +283,7 @@ macro_rules! impl_op {
impl_ref_ops! {
impl<const LANES: usize> core::ops::$assign_trait<Self> for crate::$type<LANES>
where
crate::$type<LANES>: LanesAtMost64,
crate::$type<LANES>: LanesAtMost32,
{
#[inline]
fn $assign_trait_fn(&mut self, rhs: Self) {
@ -297,7 +297,7 @@ macro_rules! impl_op {
impl_ref_ops! {
impl<const LANES: usize> core::ops::$assign_trait<$scalar> for crate::$type<LANES>
where
crate::$type<LANES>: LanesAtMost64,
crate::$type<LANES>: LanesAtMost32,
{
#[inline]
fn $assign_trait_fn(&mut self, rhs: $scalar) {
@ -343,7 +343,7 @@ macro_rules! impl_unsigned_int_ops {
impl_ref_ops! {
impl<const LANES: usize> core::ops::Div<Self> for crate::$vector<LANES>
where
crate::$vector<LANES>: LanesAtMost64,
crate::$vector<LANES>: LanesAtMost32,
{
type Output = Self;
@ -371,7 +371,7 @@ macro_rules! impl_unsigned_int_ops {
impl_ref_ops! {
impl<const LANES: usize> core::ops::Div<$scalar> for crate::$vector<LANES>
where
crate::$vector<LANES>: LanesAtMost64,
crate::$vector<LANES>: LanesAtMost32,
{
type Output = Self;
@ -394,7 +394,7 @@ macro_rules! impl_unsigned_int_ops {
impl_ref_ops! {
impl<const LANES: usize> core::ops::Div<crate::$vector<LANES>> for $scalar
where
crate::$vector<LANES>: LanesAtMost64,
crate::$vector<LANES>: LanesAtMost32,
{
type Output = crate::$vector<LANES>;
@ -408,7 +408,7 @@ macro_rules! impl_unsigned_int_ops {
impl_ref_ops! {
impl<const LANES: usize> core::ops::DivAssign<Self> for crate::$vector<LANES>
where
crate::$vector<LANES>: LanesAtMost64,
crate::$vector<LANES>: LanesAtMost32,
{
#[inline]
fn div_assign(&mut self, rhs: Self) {
@ -420,7 +420,7 @@ macro_rules! impl_unsigned_int_ops {
impl_ref_ops! {
impl<const LANES: usize> core::ops::DivAssign<$scalar> for crate::$vector<LANES>
where
crate::$vector<LANES>: LanesAtMost64,
crate::$vector<LANES>: LanesAtMost32,
{
#[inline]
fn div_assign(&mut self, rhs: $scalar) {
@ -433,7 +433,7 @@ macro_rules! impl_unsigned_int_ops {
impl_ref_ops! {
impl<const LANES: usize> core::ops::Rem<Self> for crate::$vector<LANES>
where
crate::$vector<LANES>: LanesAtMost64,
crate::$vector<LANES>: LanesAtMost32,
{
type Output = Self;
@ -461,7 +461,7 @@ macro_rules! impl_unsigned_int_ops {
impl_ref_ops! {
impl<const LANES: usize> core::ops::Rem<$scalar> for crate::$vector<LANES>
where
crate::$vector<LANES>: LanesAtMost64,
crate::$vector<LANES>: LanesAtMost32,
{
type Output = Self;
@ -484,7 +484,7 @@ macro_rules! impl_unsigned_int_ops {
impl_ref_ops! {
impl<const LANES: usize> core::ops::Rem<crate::$vector<LANES>> for $scalar
where
crate::$vector<LANES>: LanesAtMost64,
crate::$vector<LANES>: LanesAtMost32,
{
type Output = crate::$vector<LANES>;
@ -498,7 +498,7 @@ macro_rules! impl_unsigned_int_ops {
impl_ref_ops! {
impl<const LANES: usize> core::ops::RemAssign<Self> for crate::$vector<LANES>
where
crate::$vector<LANES>: LanesAtMost64,
crate::$vector<LANES>: LanesAtMost32,
{
#[inline]
fn rem_assign(&mut self, rhs: Self) {
@ -510,7 +510,7 @@ macro_rules! impl_unsigned_int_ops {
impl_ref_ops! {
impl<const LANES: usize> core::ops::RemAssign<$scalar> for crate::$vector<LANES>
where
crate::$vector<LANES>: LanesAtMost64,
crate::$vector<LANES>: LanesAtMost32,
{
#[inline]
fn rem_assign(&mut self, rhs: $scalar) {
@ -523,7 +523,7 @@ macro_rules! impl_unsigned_int_ops {
impl_ref_ops! {
impl<const LANES: usize> core::ops::Shl<Self> for crate::$vector<LANES>
where
crate::$vector<LANES>: LanesAtMost64,
crate::$vector<LANES>: LanesAtMost32,
{
type Output = Self;
@ -545,7 +545,7 @@ macro_rules! impl_unsigned_int_ops {
impl_ref_ops! {
impl<const LANES: usize> core::ops::Shl<$scalar> for crate::$vector<LANES>
where
crate::$vector<LANES>: LanesAtMost64,
crate::$vector<LANES>: LanesAtMost32,
{
type Output = Self;
@ -564,7 +564,7 @@ macro_rules! impl_unsigned_int_ops {
impl_ref_ops! {
impl<const LANES: usize> core::ops::ShlAssign<Self> for crate::$vector<LANES>
where
crate::$vector<LANES>: LanesAtMost64,
crate::$vector<LANES>: LanesAtMost32,
{
#[inline]
fn shl_assign(&mut self, rhs: Self) {
@ -576,7 +576,7 @@ macro_rules! impl_unsigned_int_ops {
impl_ref_ops! {
impl<const LANES: usize> core::ops::ShlAssign<$scalar> for crate::$vector<LANES>
where
crate::$vector<LANES>: LanesAtMost64,
crate::$vector<LANES>: LanesAtMost32,
{
#[inline]
fn shl_assign(&mut self, rhs: $scalar) {
@ -588,7 +588,7 @@ macro_rules! impl_unsigned_int_ops {
impl_ref_ops! {
impl<const LANES: usize> core::ops::Shr<Self> for crate::$vector<LANES>
where
crate::$vector<LANES>: LanesAtMost64,
crate::$vector<LANES>: LanesAtMost32,
{
type Output = Self;
@ -610,7 +610,7 @@ macro_rules! impl_unsigned_int_ops {
impl_ref_ops! {
impl<const LANES: usize> core::ops::Shr<$scalar> for crate::$vector<LANES>
where
crate::$vector<LANES>: LanesAtMost64,
crate::$vector<LANES>: LanesAtMost32,
{
type Output = Self;
@ -629,7 +629,7 @@ macro_rules! impl_unsigned_int_ops {
impl_ref_ops! {
impl<const LANES: usize> core::ops::ShrAssign<Self> for crate::$vector<LANES>
where
crate::$vector<LANES>: LanesAtMost64,
crate::$vector<LANES>: LanesAtMost32,
{
#[inline]
fn shr_assign(&mut self, rhs: Self) {
@ -641,7 +641,7 @@ macro_rules! impl_unsigned_int_ops {
impl_ref_ops! {
impl<const LANES: usize> core::ops::ShrAssign<$scalar> for crate::$vector<LANES>
where
crate::$vector<LANES>: LanesAtMost64,
crate::$vector<LANES>: LanesAtMost32,
{
#[inline]
fn shr_assign(&mut self, rhs: $scalar) {

View File

@ -24,6 +24,5 @@ macro_rules! impl_shuffle_2pow_lanes {
impl_shuffle_lane!{ $name, simd_shuffle8, 8 }
impl_shuffle_lane!{ $name, simd_shuffle16, 16 }
impl_shuffle_lane!{ $name, simd_shuffle32, 32 }
impl_shuffle_lane!{ $name, simd_shuffle64, 64 }
}
}

View File

@ -4,7 +4,7 @@ macro_rules! implement {
} => {
impl<const LANES: usize> crate::$type<LANES>
where
Self: crate::LanesAtMost64,
Self: crate::LanesAtMost32,
{
/// Returns the largest integer less than or equal to each lane.
#[cfg(feature = "std")]
@ -25,8 +25,8 @@ macro_rules! implement {
impl<const LANES: usize> crate::$type<LANES>
where
Self: crate::LanesAtMost64,
crate::$int_type<LANES>: crate::LanesAtMost64,
Self: crate::LanesAtMost32,
crate::$int_type<LANES>: crate::LanesAtMost32,
{
/// Rounds toward zero and converts to the same-width integer type, assuming that
/// the value is finite and fits in that type.

View File

@ -9,8 +9,8 @@ macro_rules! impl_float_vector {
impl<const LANES: usize> $name<LANES>
where
Self: crate::LanesAtMost64,
crate::$bits_ty<LANES>: crate::LanesAtMost64,
Self: crate::LanesAtMost32,
crate::$bits_ty<LANES>: crate::LanesAtMost32,
{
/// Raw transmutation to an unsigned integer vector type with the
/// same size and number of lanes.
@ -39,9 +39,9 @@ macro_rules! impl_float_vector {
impl<const LANES: usize> $name<LANES>
where
Self: crate::LanesAtMost64,
crate::$bits_ty<LANES>: crate::LanesAtMost64,
crate::$mask_impl_ty<LANES>: crate::LanesAtMost64,
Self: crate::LanesAtMost32,
crate::$bits_ty<LANES>: crate::LanesAtMost32,
crate::$mask_impl_ty<LANES>: crate::LanesAtMost32,
{
/// Returns true for each lane if it has a positive sign, including
/// `+0.0`, `NaN`s with positive sign bit and positive infinity.
@ -96,7 +96,7 @@ macro_rules! impl_float_vector {
#[repr(simd)]
pub struct SimdF32<const LANES: usize>([f32; LANES])
where
Self: crate::LanesAtMost64;
Self: crate::LanesAtMost32;
impl_float_vector! { SimdF32, f32, SimdU32, Mask32, SimdI32 }
@ -108,7 +108,7 @@ from_transmute_x86! { unsafe f32x8 => __m256 }
#[repr(simd)]
pub struct SimdF64<const LANES: usize>([f64; LANES])
where
Self: crate::LanesAtMost64;
Self: crate::LanesAtMost32;
impl_float_vector! { SimdF64, f64, SimdU64, Mask64, SimdI64 }

View File

@ -5,9 +5,9 @@ macro_rules! impl_integer_vector {
{ $name:ident, $type:ty, $mask_ty:ident, $mask_impl_ty:ident } => {
impl_vector! { $name, $type }
impl<const LANES: usize> Eq for $name<LANES> where Self: crate::LanesAtMost64 {}
impl<const LANES: usize> Eq for $name<LANES> where Self: crate::LanesAtMost32 {}
impl<const LANES: usize> Ord for $name<LANES> where Self: crate::LanesAtMost64 {
impl<const LANES: usize> Ord for $name<LANES> where Self: crate::LanesAtMost32 {
#[inline]
fn cmp(&self, other: &Self) -> core::cmp::Ordering {
// TODO use SIMD cmp
@ -15,7 +15,7 @@ macro_rules! impl_integer_vector {
}
}
impl<const LANES: usize> core::hash::Hash for $name<LANES> where Self: crate::LanesAtMost64 {
impl<const LANES: usize> core::hash::Hash for $name<LANES> where Self: crate::LanesAtMost32 {
#[inline]
fn hash<H>(&self, state: &mut H)
where
@ -27,8 +27,8 @@ macro_rules! impl_integer_vector {
impl<const LANES: usize> $name<LANES>
where
Self: crate::LanesAtMost64,
crate::$mask_impl_ty<LANES>: crate::LanesAtMost64,
Self: crate::LanesAtMost32,
crate::$mask_impl_ty<LANES>: crate::LanesAtMost32,
{
/// Returns true for each positive lane and false if it is zero or negative.
pub fn is_positive(self) -> crate::$mask_ty<LANES> {
@ -47,7 +47,7 @@ macro_rules! impl_integer_vector {
#[repr(simd)]
pub struct SimdIsize<const LANES: usize>([isize; LANES])
where
Self: crate::LanesAtMost64;
Self: crate::LanesAtMost32;
impl_integer_vector! { SimdIsize, isize, MaskSize, SimdIsize }
@ -67,7 +67,7 @@ from_transmute_x86! { unsafe isizex4 => __m256i }
#[repr(simd)]
pub struct SimdI128<const LANES: usize>([i128; LANES])
where
Self: crate::LanesAtMost64;
Self: crate::LanesAtMost32;
impl_integer_vector! { SimdI128, i128, Mask128, SimdI128 }
@ -78,7 +78,7 @@ from_transmute_x86! { unsafe i128x2 => __m256i }
#[repr(simd)]
pub struct SimdI16<const LANES: usize>([i16; LANES])
where
Self: crate::LanesAtMost64;
Self: crate::LanesAtMost32;
impl_integer_vector! { SimdI16, i16, Mask16, SimdI16 }
@ -90,7 +90,7 @@ from_transmute_x86! { unsafe i16x16 => __m256i }
#[repr(simd)]
pub struct SimdI32<const LANES: usize>([i32; LANES])
where
Self: crate::LanesAtMost64;
Self: crate::LanesAtMost32;
impl_integer_vector! { SimdI32, i32, Mask32, SimdI32 }
@ -102,7 +102,7 @@ from_transmute_x86! { unsafe i32x8 => __m256i }
#[repr(simd)]
pub struct SimdI64<const LANES: usize>([i64; LANES])
where
Self: crate::LanesAtMost64;
Self: crate::LanesAtMost32;
impl_integer_vector! { SimdI64, i64, Mask64, SimdI64 }
@ -114,7 +114,7 @@ from_transmute_x86! { unsafe i64x4 => __m256i }
#[repr(simd)]
pub struct SimdI8<const LANES: usize>([i8; LANES])
where
Self: crate::LanesAtMost64;
Self: crate::LanesAtMost32;
impl_integer_vector! { SimdI8, i8, Mask8, SimdI8 }

View File

@ -6,9 +6,9 @@ macro_rules! impl_unsigned_vector {
{ $name:ident, $type:ty } => {
impl_vector! { $name, $type }
impl<const LANES: usize> Eq for $name<LANES> where Self: crate::LanesAtMost64 {}
impl<const LANES: usize> Eq for $name<LANES> where Self: crate::LanesAtMost32 {}
impl<const LANES: usize> Ord for $name<LANES> where Self: crate::LanesAtMost64 {
impl<const LANES: usize> Ord for $name<LANES> where Self: crate::LanesAtMost32 {
#[inline]
fn cmp(&self, other: &Self) -> core::cmp::Ordering {
// TODO use SIMD cmp
@ -16,7 +16,7 @@ macro_rules! impl_unsigned_vector {
}
}
impl<const LANES: usize> core::hash::Hash for $name<LANES> where Self: crate::LanesAtMost64 {
impl<const LANES: usize> core::hash::Hash for $name<LANES> where Self: crate::LanesAtMost32 {
#[inline]
fn hash<H>(&self, state: &mut H)
where
@ -32,7 +32,7 @@ macro_rules! impl_unsigned_vector {
#[repr(simd)]
pub struct SimdUsize<const LANES: usize>([usize; LANES])
where
Self: crate::LanesAtMost64;
Self: crate::LanesAtMost32;
impl_unsigned_vector! { SimdUsize, usize }
@ -52,7 +52,7 @@ from_transmute_x86! { unsafe usizex4 => __m256i }
#[repr(simd)]
pub struct SimdU128<const LANES: usize>([u128; LANES])
where
Self: crate::LanesAtMost64;
Self: crate::LanesAtMost32;
impl_unsigned_vector! { SimdU128, u128 }
@ -63,7 +63,7 @@ from_transmute_x86! { unsafe u128x2 => __m256i }
#[repr(simd)]
pub struct SimdU16<const LANES: usize>([u16; LANES])
where
Self: crate::LanesAtMost64;
Self: crate::LanesAtMost32;
impl_unsigned_vector! { SimdU16, u16 }
@ -75,7 +75,7 @@ from_transmute_x86! { unsafe u16x16 => __m256i }
#[repr(simd)]
pub struct SimdU32<const LANES: usize>([u32; LANES])
where
Self: crate::LanesAtMost64;
Self: crate::LanesAtMost32;
impl_unsigned_vector! { SimdU32, u32 }
@ -87,7 +87,7 @@ from_transmute_x86! { unsafe u32x8 => __m256i }
#[repr(simd)]
pub struct SimdU64<const LANES: usize>([u64; LANES])
where
Self: crate::LanesAtMost64;
Self: crate::LanesAtMost32;
impl_unsigned_vector! { SimdU64, u64 }
@ -99,7 +99,7 @@ from_transmute_x86! { unsafe u64x4 => __m256i }
#[repr(simd)]
pub struct SimdU8<const LANES: usize>([u8; LANES])
where
Self: crate::LanesAtMost64;
Self: crate::LanesAtMost32;
impl_unsigned_vector! { SimdU8, u8 }

View File

@ -1,4 +1,3 @@
mask_tests! { mask8x8, 8 }
mask_tests! { mask8x16, 16 }
mask_tests! { mask8x32, 32 }
mask_tests! { mask8x64, 64 }

View File

@ -269,21 +269,21 @@ macro_rules! test_lanes {
fn implementation<const $lanes: usize>()
where
core_simd::SimdU8<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdU16<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdU32<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdU64<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdU128<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdUsize<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdI8<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdI16<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdI32<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdI64<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdI128<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdIsize<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdF32<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdF64<$lanes>: core_simd::LanesAtMost64,
core_simd::BitMask<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdU8<$lanes>: core_simd::LanesAtMost32,
core_simd::SimdU16<$lanes>: core_simd::LanesAtMost32,
core_simd::SimdU32<$lanes>: core_simd::LanesAtMost32,
core_simd::SimdU64<$lanes>: core_simd::LanesAtMost32,
core_simd::SimdU128<$lanes>: core_simd::LanesAtMost32,
core_simd::SimdUsize<$lanes>: core_simd::LanesAtMost32,
core_simd::SimdI8<$lanes>: core_simd::LanesAtMost32,
core_simd::SimdI16<$lanes>: core_simd::LanesAtMost32,
core_simd::SimdI32<$lanes>: core_simd::LanesAtMost32,
core_simd::SimdI64<$lanes>: core_simd::LanesAtMost32,
core_simd::SimdI128<$lanes>: core_simd::LanesAtMost32,
core_simd::SimdIsize<$lanes>: core_simd::LanesAtMost32,
core_simd::SimdF32<$lanes>: core_simd::LanesAtMost32,
core_simd::SimdF64<$lanes>: core_simd::LanesAtMost32,
core_simd::BitMask<$lanes>: core_simd::LanesAtMost32,
$body
#[cfg(target_arch = "wasm32")]
@ -324,12 +324,6 @@ macro_rules! test_lanes {
fn lanes_32() {
implementation::<32>();
}
#[test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
fn lanes_64() {
implementation::<64>();
}
}
)*
}
@ -347,21 +341,21 @@ macro_rules! test_lanes_panic {
fn implementation<const $lanes: usize>()
where
core_simd::SimdU8<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdU16<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdU32<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdU64<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdU128<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdUsize<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdI8<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdI16<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdI32<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdI64<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdI128<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdIsize<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdF32<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdF64<$lanes>: core_simd::LanesAtMost64,
core_simd::BitMask<$lanes>: core_simd::LanesAtMost64,
core_simd::SimdU8<$lanes>: core_simd::LanesAtMost32,
core_simd::SimdU16<$lanes>: core_simd::LanesAtMost32,
core_simd::SimdU32<$lanes>: core_simd::LanesAtMost32,
core_simd::SimdU64<$lanes>: core_simd::LanesAtMost32,
core_simd::SimdU128<$lanes>: core_simd::LanesAtMost32,
core_simd::SimdUsize<$lanes>: core_simd::LanesAtMost32,
core_simd::SimdI8<$lanes>: core_simd::LanesAtMost32,
core_simd::SimdI16<$lanes>: core_simd::LanesAtMost32,
core_simd::SimdI32<$lanes>: core_simd::LanesAtMost32,
core_simd::SimdI64<$lanes>: core_simd::LanesAtMost32,
core_simd::SimdI128<$lanes>: core_simd::LanesAtMost32,
core_simd::SimdIsize<$lanes>: core_simd::LanesAtMost32,
core_simd::SimdF32<$lanes>: core_simd::LanesAtMost32,
core_simd::SimdF64<$lanes>: core_simd::LanesAtMost32,
core_simd::BitMask<$lanes>: core_simd::LanesAtMost32,
$body
#[test]
@ -399,12 +393,6 @@ macro_rules! test_lanes_panic {
fn lanes_32() {
implementation::<32>();
}
#[test]
#[should_panic]
fn lanes_64() {
implementation::<64>();
}
}
)*
}