Skip to content
Merged
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
32 changes: 17 additions & 15 deletions .github/workflows/simba-ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Check formatting
run: cargo fmt -- --check
clippy:
runs-on: ubuntu-latest
env:
RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
Expand All @@ -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:
Expand All @@ -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;
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
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "simba"
version = "0.9.0"
version = "0.9.1"
authors = ["sebcrozet <developer@crozet.re>"]
description = "SIMD algebra for Rust"
keywords = ["algebra", "simd", "math"]
Expand Down
9 changes: 8 additions & 1 deletion src/simd/auto_simd_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),*])
}
Expand All @@ -83,28 +84,34 @@ macro_rules! impl_bool_simd (
impl Not for AutoSimd<$t> {
type Output = Self;

#[inline]
#[inline(always)]
fn not(self) -> Self {
self.map(|x| !x)
}
}

impl BitAnd<AutoSimd<$t>> for AutoSimd<$t> {
type Output = Self;

#[inline(always)]
fn bitand(self, rhs: Self) -> Self {
self.zip_map(rhs, |x, y| x & y)
}
}

impl BitOr<AutoSimd<$t>> for AutoSimd<$t> {
type Output = Self;

#[inline(always)]
fn bitor(self, rhs: Self) -> Self {
self.zip_map(rhs, |x, y| x | y)
}
}

impl BitXor<AutoSimd<$t>> for AutoSimd<$t> {
type Output = Self;

#[inline(always)]
fn bitxor(self, rhs: Self) -> Self {
self.zip_map(rhs, |x, y| x ^ y)
}
Expand Down
23 changes: 13 additions & 10 deletions src/simd/wide_simd_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,23 +119,23 @@ macro_rules! impl_wide_f32 (
pub const ONE: Self = $WideF32xX(<wide::$f32xX>::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([
Expand All @@ -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()
}
}
Expand Down Expand Up @@ -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)]
Expand Down Expand Up @@ -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]
Expand Down
Loading