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 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"] 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) } diff --git a/src/simd/wide_simd_impl.rs b/src/simd/wide_simd_impl.rs index ead5e24..26ec21d 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() } } @@ -319,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)] @@ -1027,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]