Skip to content
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
20 changes: 13 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ the rust programming language.
))]
std::compile_error!("The `simd-is-enabled` feature should not be enabled explicitly. Please enable the `simd-stable` or the `simd-nightly` feature instead.");
#[cfg(all(feature = "simd-is-enabled", feature = "enhanced-determinism"))]
std::compile_error!(
"SIMD cannot be enabled when the `enhanced-determinism` feature is also enabled."
std::compile_error!(
"SIMD cannot be enabled when the `enhanced-determinism` feature is also enabled."
);
#[cfg(all(feature = "simd-is-enabled", feature = "f64"))]
#[cfg(all(feature = "f64", feature="simd-stable"))]
std::compile_error!(
"Explicit SIMD optimization are not yet supported when the f64 feature is enabled."
"Explicit SIMD optimizations on stable are not yet supported when the f64 feature is enabled."
);

macro_rules! array(
Expand Down Expand Up @@ -254,7 +254,7 @@ mod simd {
mod simd {
#[allow(unused_imports)]
#[cfg(feature = "simd-nightly")]
use simba::simd::{f32x16, f32x4, f32x8, m32x16, m32x4, m32x8, u8x16, u8x4, u8x8};
use simba::simd::{f32x16, f32x4, f32x8, m32x16, m32x4, m32x8, u8x16, u8x4, u8x8, f64x4, m64x4};
#[cfg(feature = "simd-stable")]
use simba::simd::{WideBoolF32x4, WideF32x4};

Expand All @@ -268,12 +268,18 @@ mod simd {
#[cfg(not(feature = "simd-nightly"))]
/// A SIMD bool with SIMD_WIDTH lanes.
pub type SimdBool = WideBoolF32x4;
#[cfg(feature = "simd-nightly")]
#[cfg(all(feature = "simd-nightly", feature="f32"))]
/// A SIMD float with SIMD_WIDTH lanes.
pub type SimdReal = f32x4;
#[cfg(feature = "simd-nightly")]
#[cfg(all(feature = "simd-nightly", feature="f64"))]
/// A SIMD float with SIMD_WIDTH lanes.
pub type SimdReal = f64x4;
#[cfg(all(feature = "simd-nightly", feature="f32"))]
/// A bool float with SIMD_WIDTH lanes.
pub type SimdBool = m32x4;
#[cfg(all(feature = "simd-nightly", feature="f64"))]
/// A bool float with SIMD_WIDTH lanes.
pub type SimdBool = m64x4;

// pub const SIMD_WIDTH: usize = 8;
// pub const SIMD_LAST_INDEX: usize = 7;
Expand Down
75 changes: 73 additions & 2 deletions src/utils/sdp_matrix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ where
}
}

#[cfg(feature = "simd-nightly")]
#[cfg(all(feature = "simd-nightly", feature="f32"))]
impl From<[SdpMatrix3<Real>; 8]> for SdpMatrix3<simba::simd::f32x8> {
fn from(data: [SdpMatrix3<Real>; 8]) -> Self {
SdpMatrix3 {
Expand Down Expand Up @@ -427,7 +427,7 @@ impl From<[SdpMatrix3<Real>; 8]> for SdpMatrix3<simba::simd::f32x8> {
}
}

#[cfg(feature = "simd-nightly")]
#[cfg(all(feature = "simd-nightly", feature="f32"))]
impl From<[SdpMatrix3<Real>; 16]> for SdpMatrix3<simba::simd::f32x16> {
fn from(data: [SdpMatrix3<Real>; 16]) -> Self {
SdpMatrix3 {
Expand Down Expand Up @@ -542,3 +542,74 @@ impl From<[SdpMatrix3<Real>; 16]> for SdpMatrix3<simba::simd::f32x16> {
}
}
}


#[cfg(all(feature = "simd-nightly", feature="f64", not(feature="f32")))]
impl From<[SdpMatrix3<Real>; 8]> for SdpMatrix3<simba::simd::f64x8> {
fn from(data: [SdpMatrix3<Real>; 8]) -> Self {
SdpMatrix3 {
m11: simba::simd::f64x8::from([
data[0].m11,
data[1].m11,
data[2].m11,
data[3].m11,
data[4].m11,
data[5].m11,
data[6].m11,
data[7].m11,
]),
m12: simba::simd::f64x8::from([
data[0].m12,
data[1].m12,
data[2].m12,
data[3].m12,
data[4].m12,
data[5].m12,
data[6].m12,
data[7].m12,
]),
m13: simba::simd::f64x8::from([
data[0].m13,
data[1].m13,
data[2].m13,
data[3].m13,
data[4].m13,
data[5].m13,
data[6].m13,
data[7].m13,
]),
m22: simba::simd::f64x8::from([
data[0].m22,
data[1].m22,
data[2].m22,
data[3].m22,
data[4].m22,
data[5].m22,
data[6].m22,
data[7].m22,
]),
m23: simba::simd::f64x8::from([
data[0].m23,
data[1].m23,
data[2].m23,
data[3].m23,
data[4].m23,
data[5].m23,
data[6].m23,
data[7].m23,
]),
m33: simba::simd::f64x8::from([
data[0].m33,
data[1].m33,
data[2].m33,
data[3].m33,
data[4].m33,
data[5].m33,
data[6].m33,
data[7].m33,
]),
}
}
}