From 7448d372679734dea9b538c9f26b09059673f9a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Fri, 5 Sep 2025 16:13:08 +0200 Subject: [PATCH 1/5] feat: make more wide from/to array functions public --- src/simd/wide_simd_impl.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/simd/wide_simd_impl.rs b/src/simd/wide_simd_impl.rs index ead5e24..c80703c 100644 --- a/src/simd/wide_simd_impl.rs +++ b/src/simd/wide_simd_impl.rs @@ -119,23 +119,23 @@ macro_rules! impl_wide_f32 ( pub const ONE: Self = $WideF32xX(::ONE); #[inline(always)] - fn into_arr(self) -> [$f32; $lanes] { + pub fn into_arr(self) -> [$f32; $lanes] { self.0.into() } #[inline(always)] - fn from_arr(arr: [$f32; $lanes]) -> Self { + pub fn from_arr(arr: [$f32; $lanes]) -> Self { Self(arr.into()) } #[inline(always)] - fn map(self, f: impl Fn($f32) -> $f32) -> Self { + pub fn map(self, f: impl Fn($f32) -> $f32) -> Self { let arr = self.into_arr(); Self::from([f(arr[0]), $(f(arr[$ii])),+]) } #[inline(always)] - fn zip_map(self, rhs: Self, f: impl Fn($f32, $f32) -> $f32) -> Self { + pub fn zip_map(self, rhs: Self, f: impl Fn($f32, $f32) -> $f32) -> Self { let arr = self.into_arr(); let rhs = rhs.into_arr(); Self::from([ @@ -146,11 +146,13 @@ macro_rules! impl_wide_f32 ( } impl $WideBoolF32xX { - fn from_arr(arr: [$f32; $lanes]) -> Self { + #[inline(always)] + pub fn from_arr(arr: [$f32; $lanes]) -> Self { Self(arr.into()) } - fn into_arr(self) -> [$f32; $lanes] { + #[inline(always)] + pub fn into_arr(self) -> [$f32; $lanes] { self.0.into() } } From 282e2677ebcd58a22e919ff2aa913595efe1c526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Fri, 5 Sep 2025 16:13:23 +0200 Subject: [PATCH 2/5] feat: use simd versions of more wide operations --- src/simd/wide_simd_impl.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/simd/wide_simd_impl.rs b/src/simd/wide_simd_impl.rs index c80703c..26ec21d 100644 --- a/src/simd/wide_simd_impl.rs +++ b/src/simd/wide_simd_impl.rs @@ -321,17 +321,17 @@ macro_rules! impl_wide_f32 ( #[inline(always)] fn all(self) -> bool { - self == Self(!wide::$f32xX::ZERO) + self.0.all() } #[inline(always)] fn any(self) -> bool { - self != Self(wide::$f32xX::ZERO) + self.0.any() } #[inline(always)] fn none(self) -> bool { - self == Self(wide::$f32xX::ZERO) + self.0.none() } #[inline(always)] @@ -1029,7 +1029,8 @@ macro_rules! impl_wide_f32 ( #[inline(always)] fn simd_sin_cos(self) -> (Self, Self) { - (self.simd_sin(), self.simd_cos()) + let (sin, cos) = self.0.sin_cos(); + ($WideF32xX(sin), $WideF32xX(cos)) } // #[inline(always] From 5ad6ddcab00863771e49abcee172a6ecc0925053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Fri, 5 Sep 2025 16:13:35 +0200 Subject: [PATCH 3/5] feat: add some missing inlines --- src/simd/auto_simd_impl.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/simd/auto_simd_impl.rs b/src/simd/auto_simd_impl.rs index 9a48ce8..9526d08 100644 --- a/src/simd/auto_simd_impl.rs +++ b/src/simd/auto_simd_impl.rs @@ -68,6 +68,7 @@ macro_rules! impl_bool_simd ( pub const ZERO: Self = AutoSimd([false; $lanes]); pub const ONE: Self = AutoSimd([true; $lanes]); + #[inline(always)] pub fn new($($i: bool),*) -> Self { AutoSimd([$($i),*]) } @@ -83,7 +84,7 @@ macro_rules! impl_bool_simd ( impl Not for AutoSimd<$t> { type Output = Self; - #[inline] + #[inline(always)] fn not(self) -> Self { self.map(|x| !x) } @@ -91,6 +92,8 @@ macro_rules! impl_bool_simd ( impl BitAnd> for AutoSimd<$t> { type Output = Self; + + #[inline(always)] fn bitand(self, rhs: Self) -> Self { self.zip_map(rhs, |x, y| x & y) } @@ -98,6 +101,8 @@ macro_rules! impl_bool_simd ( impl BitOr> for AutoSimd<$t> { type Output = Self; + + #[inline(always)] fn bitor(self, rhs: Self) -> Self { self.zip_map(rhs, |x, y| x | y) } @@ -105,6 +110,8 @@ macro_rules! impl_bool_simd ( impl BitXor> for AutoSimd<$t> { type Output = Self; + + #[inline(always)] fn bitxor(self, rhs: Self) -> Self { self.zip_map(rhs, |x, y| x ^ y) } From f73f3b2749c56ed667c21b9c3ed8f7bf420642dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Fri, 5 Sep 2025 16:17:15 +0200 Subject: [PATCH 4/5] Release v0.9.1 --- CHANGELOG | 6 ++++++ Cargo.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index e5e007e..9c44e2f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +## Release v0.9.1 (05 Sept. 2025) +- `into_arr`, `from_arr`, `map`, `zip_map` are now public on `WideF32x4`, `WideF32x8` and `WideF64x4`. +- `from_arr` and `into_arr` are now public on `WideBoolF32x4`, `WideBoolF32x8`, `WideBoolF64x4`. +- Use SIMD implementations of `WideBool*` methods `all`, `any`, and `none`. +- Inline more `AutoSimd` methods. + ## Release v0.9.0 (22 June 2023) - The `cuda` feature has been removed, as the toolchain it depends on is long abandoned. - The `packed_simd` feature has been removes as it has been incompatible with the `nightly` compiler for several months. diff --git a/Cargo.toml b/Cargo.toml index 164035e..01b2d5e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simba" -version = "0.9.0" +version = "0.9.1" authors = ["sebcrozet "] description = "SIMD algebra for Rust" keywords = ["algebra", "simd", "math"] From 0e1064cc06ff7f3a65a6a56907d188633da5aa19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Fri, 5 Sep 2025 16:21:38 +0200 Subject: [PATCH 5/5] fix no-std ci --- .github/workflows/simba-ci-build.yml | 32 +++++++++++++++------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/.github/workflows/simba-ci-build.yml b/.github/workflows/simba-ci-build.yml index 6dc3ae1..a50892c 100644 --- a/.github/workflows/simba-ci-build.yml +++ b/.github/workflows/simba-ci-build.yml @@ -13,7 +13,7 @@ jobs: fmt: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Check formatting run: cargo fmt -- --check clippy: @@ -21,7 +21,7 @@ jobs: env: RUSTFLAGS: -D warnings steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install latest nightly uses: actions-rs/toolchain@v1 with: @@ -33,7 +33,7 @@ jobs: build-native: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install latest nightly uses: actions-rs/toolchain@v1 with: @@ -52,22 +52,24 @@ jobs: build-wasm: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - run: rustup target add wasm32-unknown-unknown - name: build run: cargo build --verbose --target wasm32-unknown-unknown; build-no-std: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Install latest nightly - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v4 + - name: Install latest stable + uses: dtolnay/rust-toolchain@master with: - toolchain: nightly - override: true - - name: install xargo - run: cp .github/Xargo.toml .; rustup component add rust-src; cargo install -f xargo; - - name: build x86_64-unknown-linux-gnu - run: xargo build --verbose --no-default-features --target=x86_64-unknown-linux-gnu; - - name: build x86_64-unknown-linux-gnu --features libm - run: xargo build --verbose --no-default-features --features libm --target=x86_64-unknown-linux-gnu; \ No newline at end of file + toolchain: stable + targets: "x86_64-unknown-none,thumbv7em-none-eabihf" + - name: build x86_64-unknown-none + run: cargo build --verbose --no-default-features --target=x86_64-unknown-none + - name: build x86_64-unknown-none --features libm + run: cargo build --verbose --no-default-features --features libm --target=x86_64-unknown-none + - name: build thumbv7em-none-eabihf + run: cargo build --verbose --no-default-features --target=thumbv7em-none-eabihf + - name: build thumbv7em-none-eabihf --features libm + run: cargo build --verbose --no-default-features --features libm --target=thumbv7em-none-eabihf