From 1905b1694c9a8eb07f547c870bedaa956f8b5441 Mon Sep 17 00:00:00 2001 From: Michael Pfaff Date: Wed, 13 Mar 2024 21:25:07 -0400 Subject: [PATCH] Fixes for newer rust versions --- src/lib.rs | 2 +- src/simd.rs | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index e8ff8a2..83664e3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,11 +4,11 @@ #![feature(const_maybe_uninit_uninit_array)] #![feature(const_trait_impl)] #![feature(core_intrinsics)] +#![feature(effects)] #![feature(maybe_uninit_array_assume_init)] #![feature(maybe_uninit_uninit_array)] #![feature(portable_simd)] #![feature(ptr_metadata)] -#![feature(stdsimd)] pub mod simd; pub mod util; diff --git a/src/simd.rs b/src/simd.rs index 770932f..c77e3d6 100644 --- a/src/simd.rs +++ b/src/simd.rs @@ -308,11 +308,11 @@ macro_rules! impl_ops { W_512 if all(any(target_arch = "x86", target_arch = "x86_64"), target_feature = "avx512f") => unsafe { cast(arch::$set1_512(self as i8)) }, _ => { #[inline(always)] - const fn compiletime(_: $ty) -> Simd<$ty, LANES> + const fn compiletime(v: $ty) -> Simd<$ty, LANES> where LaneCount: SupportedLaneCount, { - panic!("unsupported compile-time splat"); + Simd::from_array([v; LANES]) } #[inline(always)] fn runtime(v: $ty) -> Simd<$ty, LANES> @@ -321,7 +321,7 @@ macro_rules! impl_ops { { Simd::splat(v) } - unsafe { const_eval_select((self,), compiletime, runtime) } + const_eval_select((self,), compiletime, runtime) }, } @@ -332,7 +332,7 @@ macro_rules! impl_ops { where LaneCount: SupportedLaneCount, { - <$ty>::splat(0) + Simd::from_array([0; LANES]) } #[inline(always)] fn runtime() -> Simd<$ty, LANES> @@ -341,7 +341,7 @@ macro_rules! impl_ops { { unsafe { cast(arch::_mm_setzero_si128()) } } - unsafe { const_eval_select((), compiletime, runtime) } + const_eval_select((), compiletime, runtime) }, W_256 if all(any(target_arch = "x86", target_arch = "x86_64"), target_feature = "avx") => { #[inline(always)] @@ -349,7 +349,7 @@ macro_rules! impl_ops { where LaneCount: SupportedLaneCount, { - <$ty>::splat(0) + Simd::from_array([0; LANES]) } #[inline(always)] fn runtime() -> Simd<$ty, LANES> @@ -358,7 +358,7 @@ macro_rules! impl_ops { { unsafe { cast(arch::_mm256_setzero_si256()) } } - unsafe { const_eval_select((), compiletime, runtime) } + const_eval_select((), compiletime, runtime) }, W_512 if all(any(target_arch = "x86", target_arch = "x86_64"), target_feature = "avx512f") => { #[inline(always)] @@ -366,7 +366,7 @@ macro_rules! impl_ops { where LaneCount: SupportedLaneCount, { - <$ty>::splat(0) + Simd::from_array([0; LANES]) } #[inline(always)] fn runtime() -> Simd<$ty, LANES> @@ -375,7 +375,7 @@ macro_rules! impl_ops { { unsafe { cast(arch::_mm512_setzero_si512()) } } - unsafe { const_eval_select((), compiletime, runtime) } + const_eval_select((), compiletime, runtime) }, _ => Self::splat(0), }