Skip to content

Commit

Permalink
Fix simd tests
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Jan 15, 2024
1 parent 3a59c6d commit 1837363
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
8 changes: 7 additions & 1 deletion src/compute/aggregate/simd/packed.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::simd::{SimdFloat as _, SimdInt as _, SimdOrd as _, SimdUint as _};
use std::simd::prelude::*;

use crate::types::simd::*;

Expand Down Expand Up @@ -35,31 +35,37 @@ macro_rules! simd_ord_int {

#[inline]
fn max_element(self) -> $type {
use std::simd::prelude::*;
self.reduce_max()
}

#[inline]
fn min_element(self) -> $type {
use std::simd::prelude::*;
self.reduce_min()
}

#[inline]
fn max_lane(self, x: Self) -> Self {
use std::simd::prelude::*;
self.simd_max(x)
}

#[inline]
fn min_lane(self, x: Self) -> Self {
use std::simd::prelude::*;
self.simd_min(x)
}

#[inline]
fn new_min() -> Self {
use std::simd::prelude::*;
Self::splat(Self::MAX)
}

#[inline]
fn new_max() -> Self {
use std::simd::prelude::*;
Self::splat(Self::MIN)
}
}
Expand Down
20 changes: 13 additions & 7 deletions src/compute/comparison/simd/packed.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::convert::TryInto;
use std::simd::{SimdPartialEq, SimdPartialOrd, ToBitMask};
use std::simd::prelude::*;

use crate::types::simd::*;
use crate::types::{days_ms, f16, i256, months_days_ns};
Expand Down Expand Up @@ -29,34 +29,40 @@ macro_rules! simd8 {
impl Simd8PartialEq for $md {
#[inline]
fn eq(self, other: Self) -> u8 {
self.simd_eq(other).to_bitmask()
use std::simd::prelude::*;
self.simd_eq(other).to_bitmask().try_into().unwrap()
}

#[inline]
fn neq(self, other: Self) -> u8 {
self.simd_ne(other).to_bitmask()
use std::simd::prelude::*;
self.simd_ne(other).to_bitmask().try_into().unwrap()
}
}

impl Simd8PartialOrd for $md {
#[inline]
fn lt_eq(self, other: Self) -> u8 {
self.simd_le(other).to_bitmask()
use std::simd::prelude::*;
self.simd_le(other).to_bitmask().try_into().unwrap()
}

#[inline]
fn lt(self, other: Self) -> u8 {
self.simd_lt(other).to_bitmask()
use std::simd::prelude::*;
self.simd_lt(other).to_bitmask().try_into().unwrap()
}

#[inline]
fn gt_eq(self, other: Self) -> u8 {
self.simd_ge(other).to_bitmask()
use std::simd::prelude::*;
self.simd_ge(other).to_bitmask().try_into().unwrap()
}

#[inline]
fn gt(self, other: Self) -> u8 {
self.simd_gt(other).to_bitmask()
use std::simd::prelude::*;
self.simd_gt(other).to_bitmask().try_into().unwrap()
}
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/types/simd/packed.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub use std::simd::{
f32x16, f32x8, f64x8, i16x32, i16x8, i32x16, i32x8, i64x8, i8x64, i8x8, mask32x16 as m32x16,
mask64x8 as m64x8, mask8x64 as m8x64, u16x32, u16x8, u32x16, u32x8, u64x8, u8x64, u8x8,
SimdPartialEq,
mask64x8 as m64x8, mask8x64 as m8x64, prelude::*, u16x32, u16x8, u32x16, u32x8, u64x8, u8x64,
u8x8,
};

/// Vector of 32 16-bit masks
Expand Down

0 comments on commit 1837363

Please sign in to comment.