Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portable SIMD subtree update #135701

Open
wants to merge 104 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
bd7c794
Sync portable-simd to 2023 July 07
workingjubilee Jul 7, 2023
78c05f9
remove repetitive words
cuishuang Jul 15, 2023
5895729
use visibility to check unused imports and delete some stmts
bvanjoi Oct 15, 2023
62030c7
Merge commit 'e0e9a4517f9fc021283514da387e70a56061bd3e' into sync-por…
calebzulawski Nov 26, 2023
c6b3b35
Remove link to core::arch::x86_64
calebzulawski Dec 2, 2023
08069a5
portable-simd: add missing feature gate
RalfJung Dec 4, 2023
98fc771
Fix target_feature config in portable-simd
Urgau Dec 12, 2023
7e65a05
Disable conversions between portable_simd and stdarch on big-endian ARM
Amanieu Jan 30, 2024
f699661
Merge commit '649110751ef4f27440d7cc711b3e07d11bf02d4a' into sync-por…
calebzulawski Feb 18, 2024
8d2208e
Merge commit 'cff979eec1ac0473fc4960ee6cde462c6aeda824' into sync-por…
dpaoliello Mar 22, 2024
6c39a26
add without_provenance to pointer types
RalfJung Mar 23, 2024
def711f
rename ptr::from_exposed_addr -> ptr::with_exposed_provenance
RalfJung Mar 23, 2024
c7a9561
also rename the SIMD intrinsic
RalfJung Mar 23, 2024
5fa5358
Merge pull request #408 from RalfJung/without_provenance
calebzulawski Mar 24, 2024
61daba9
Import the 2021 prelude in the core crate
dpaoliello Mar 25, 2024
bfacd14
Add loongarch64 vendor conversions
heiher Mar 20, 2024
53fe1a3
Merge pull request #410 from heiher/loongarch64
calebzulawski Apr 1, 2024
93d3300
Rollup merge of #122935 - RalfJung:with-exposed-provenance, r=Amanieu
jhpratt Apr 3, 2024
b039861
rename `expose_addr` to `expose_provenance`
joboet Apr 3, 2024
0d6e714
run Miri tests on CI
RalfJung Apr 6, 2024
48d411b
Merge pull request #411 from RalfJung/miri
calebzulawski Apr 6, 2024
5533932
do not run the 4-lane tests in Miri
RalfJung Apr 9, 2024
f79ce11
document PartialOrd difference to simd_min and simd_max
KonradHoeffner Apr 10, 2024
ef5f073
document Ord difference to simd_min and simd_max
KonradHoeffner Apr 10, 2024
979a495
Merge pull request #413 from KonradHoeffner/patch-1
calebzulawski Apr 10, 2024
7ba49ef
Import the 2021 prelude in the core crate
dpaoliello Mar 25, 2024
2b03143
rename ptr::from_exposed_addr -> ptr::with_exposed_provenance
RalfJung Mar 23, 2024
6da2337
also rename the SIMD intrinsic
RalfJung Mar 23, 2024
b8a18fa
rename `expose_addr` to `expose_provenance`
joboet Apr 3, 2024
f0cbf40
Merge pull request #414 from rust-lang/sync-2024-04-09
calebzulawski Apr 11, 2024
d5dfa72
Merge pull request #412 from RalfJung/miri-lanes
calebzulawski Apr 11, 2024
6c68152
Pin toolchain
calebzulawski Apr 11, 2024
14ae03d
Fix docs
calebzulawski Apr 11, 2024
fe815f7
Simplify CI
calebzulawski Apr 11, 2024
3125888
Merge pull request #415 from rust-lang/fix-ci
programmerjake Apr 11, 2024
4fa3e88
Stabilise `inline_const`
nbdd0121 Apr 19, 2024
e72b450
Make splat const fn
calebzulawski Apr 30, 2024
c886e69
Merge pull request #417 from rust-lang/const-splat
calebzulawski Apr 30, 2024
9314128
Lock rust version
calebzulawski Apr 30, 2024
4fcf18b
Fix macos tests in CI
calebzulawski Apr 30, 2024
1419136
Merge pull request #419 from rust-lang/macos-arm-ci
calebzulawski Apr 30, 2024
7cd6f95
Merge pull request #418 from rust-lang/lock-rust-version
programmerjake Apr 30, 2024
3927f4a
Add `size_of`, `size_of_val`, `align_of`, and `align_of_val` to the p…
joshtriplett Mar 28, 2024
435f706
Fix typos (taking into account review comments)
blyxyas May 18, 2024
4da8687
Rollup merge of #123168 - joshtriplett:size-of-prelude, r=Amanieu
workingjubilee Jun 5, 2024
675401b
Add extend special swizzle fn, and implement special swizzle fns for …
calebzulawski Jun 5, 2024
3733375
Remove bitmask vectors in favor of extracting bitmasks
calebzulawski Jun 5, 2024
bd92b7c
Fix clippy lints
calebzulawski Jun 5, 2024
8c31005
Merge pull request #423 from rust-lang/bitmask-again-again-again
calebzulawski Jun 5, 2024
3c398a0
Add arm64ec to the list of architectures to check
dpaoliello Jun 13, 2024
c79585c
Merge pull request #424 from dpaoliello/checkarm64ec
calebzulawski Jun 15, 2024
227a9d9
Fix layout of non-power-of-two length vectors
calebzulawski Jun 3, 2024
6e08442
Fix Mask::all must_use attribute
gstvg Jun 19, 2024
f43e99a
Merge pull request #425 from gstvg/patch-1
calebzulawski Jun 19, 2024
30a6317
Convert some module-level `//` and `///` comments to `//!`.
nnethercote Jun 19, 2024
2937f6f
Add blank lines after module-level `//!` comments.
nnethercote Jun 19, 2024
b173176
wasm64 build with target-feature=+simd128,+atomics
wooden-worm Jun 24, 2024
048ba3e
Fix doc nits
bitfield Jul 15, 2024
f336406
Add aarch64 workarounds
calebzulawski Jun 7, 2024
9f7fec8
Perform aarch64 div/rem as scalar op
calebzulawski Aug 7, 2024
a49f77e
Swap lanes tested on miri
calebzulawski Aug 7, 2024
751c3b5
Update crates/test_helpers/src/lib.rs
calebzulawski Aug 8, 2024
7f6a981
Disable testing most lanes to improve CI times
calebzulawski Aug 8, 2024
2a3b8ad
Reduce proptest iterations
calebzulawski Aug 8, 2024
d7d060a
Build test dependencies with optimization
calebzulawski Aug 10, 2024
283acf4
Merge pull request #422 from rust-lang/non-power-of-two-layout
calebzulawski Aug 13, 2024
c992db6
Add `abs_diff` function to `SimdInt` and `SimdUint` traits
okaneco Aug 25, 2024
4697d39
Merge pull request #429 from okaneco/abs_diff
calebzulawski Aug 25, 2024
d5abbfa
Fix avx512vbmi swizzle_dyn implementation
cvijdea-bd Aug 25, 2024
f6519c5
Merge pull request #431 from cvijdea-bd/fix-swizzle-dyn-vbmi
calebzulawski Aug 27, 2024
bbcfdb5
fix: swizzle_mask docs
gstvg Aug 29, 2024
8fdb4f8
Merge pull request #434 from gstvg/fix_swizzle_docs
calebzulawski Aug 29, 2024
c535320
fix typo in cmp_ne docs
LaihoE Aug 30, 2024
1ef335e
Merge pull request #435 from LaihoE/fix_ne_typo
calebzulawski Aug 30, 2024
b6222cb
ci: bump actions/checkout to v4
trivikr Sep 9, 2024
e967f5e
Merge pull request #436 from trivikr/actions-checkout-v4
calebzulawski Sep 9, 2024
27e2832
Add count_ones() and count_zeros()
AndrewScull Sep 11, 2024
5fb43ca
Merge pull request #437 from AndrewScull/ctpop
calebzulawski Sep 11, 2024
00c3b6d
Use -0.0 as the neutral additive float
workingjubilee Sep 12, 2024
c080ba5
Exempt Arm v7 Neon from subnormal-related tests
workingjubilee Sep 12, 2024
4111fb2
simd_shuffle: require index argument to be a vector
RalfJung Sep 12, 2024
2458792
stabilize const_intrinsic_copy
RalfJung Sep 23, 2024
c7d9ad8
Add shift_elements_{left,right} for Simd and Masks
sammysheep Sep 27, 2024
55b4b74
Add tests, make public
sammysheep Sep 27, 2024
f5fea57
Change API to accept a `padding` argument
sammysheep Sep 27, 2024
8cff838
Update crates/core_simd/src/swizzle.rs
sammysheep Sep 28, 2024
c9c0bf9
Update crates/core_simd/src/swizzle.rs
sammysheep Sep 28, 2024
9392fb1
Change mask function to accept bool
sammysheep Sep 28, 2024
158e240
Merge pull request #441 from sammysheep/shift_elements
calebzulawski Sep 28, 2024
6c1656d
move strict provenance lints to new feature gate, remove old feature …
RalfJung Sep 14, 2024
7e162d1
rust-lang/portable-simd#443: Add armv7 neon mplementation for `Simd<…
hkratz Oct 22, 2024
5523a31
Merge rust-lang/portable-simd#438: Use -0.0 as the neutral additive f…
workingjubilee Oct 22, 2024
35ac70a
ci: add support for loongarch64-unknown-linux-gnu
heiher Nov 2, 2024
b049c50
Merge pull request #444 from heiher/loong64-ci
calebzulawski Nov 4, 2024
f6a2276
add rustc_const_unstable attribute to Simd::splat
AquaEBM Nov 25, 2024
49176ae
Merge pull request #446 from AquaEBM/master
calebzulawski Nov 25, 2024
8423171
Bump `stdarch`
daxpedda Dec 15, 2024
a2c745e
Merge branch 'sync-upstream-2025-01-16' into test
calebzulawski Jan 16, 2025
638667a
Remove stable features
calebzulawski Jan 16, 2025
4b1a23e
Merge pull request #448 from rust-lang/sync-upstream
calebzulawski Jan 18, 2025
15c1972
Add script for syncing subtree
calebzulawski Jan 18, 2025
3383cfb
Merge pull request #449 from rust-lang/subtree-sync-script
calebzulawski Jan 18, 2025
1ff6c55
Merge commit '3383cfbd3572465febc7a8f816a46304373de46a' into sync-fro…
calebzulawski Jan 18, 2025
52b42d7
Update tests for std::simd subtree sync
calebzulawski Jan 19, 2025
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
125 changes: 52 additions & 73 deletions library/portable-simd/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,15 @@ on:
env:
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
PROPTEST_CASES: 64

jobs:
rustfmt:
name: "rustfmt"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup Rust
run: |
rustup update nightly --no-self-update
rustup default nightly
rustup component add rustfmt
- uses: actions/checkout@v4
- name: Run rustfmt
run: cargo fmt --all -- --check

Expand All @@ -37,7 +33,9 @@ jobs:
- i686-unknown-linux-gnu
- i586-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- arm64ec-pc-windows-msvc
- armv7-unknown-linux-gnueabihf
- loongarch64-unknown-linux-gnu
# non-nightly since https://github.com/rust-lang/rust/pull/113274
# - mips-unknown-linux-gnu
# - mips64-unknown-linux-gnuabi64
Expand All @@ -49,13 +47,9 @@ jobs:
- wasm32-unknown-unknown

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup Rust
run: |
rustup update nightly --no-self-update
rustup default nightly
rustup target add ${{ matrix.target }}
rustup component add clippy
run: rustup target add ${{ matrix.target }}
- name: Run Clippy
run: cargo clippy --all-targets --target ${{ matrix.target }}

Expand All @@ -65,26 +59,19 @@ jobs:
strategy:
fail-fast: false
matrix:
target: [x86_64-pc-windows-msvc, i686-pc-windows-msvc, i586-pc-windows-msvc, x86_64-unknown-linux-gnu, x86_64-apple-darwin]
target: [x86_64-pc-windows-msvc, i686-pc-windows-msvc, i586-pc-windows-msvc, x86_64-unknown-linux-gnu]
# `default` means we use the default target config for the target,
# `native` means we run with `-Ctarget-cpu=native`, and anything else is
# an arg to `-Ctarget-feature`
target_feature: [default, native, +sse3, +ssse3, +sse4.1, +sse4.2, +avx, +avx2]

exclude:
# The macos runners seem to only reliably support up to `avx`.
- { target: x86_64-apple-darwin, target_feature: +avx2 }
# These features are statically known to be present for all 64 bit
# macs, and thus are covered by the `default` test
- { target: x86_64-apple-darwin, target_feature: +sse3 }
- { target: x86_64-apple-darwin, target_feature: +ssse3 }
# -Ctarget-cpu=native sounds like bad-news if target != host
- { target: i686-pc-windows-msvc, target_feature: native }
- { target: i586-pc-windows-msvc, target_feature: native }

include:
# Populate the `matrix.os` field
- { target: x86_64-apple-darwin, os: macos-latest }
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
- { target: x86_64-pc-windows-msvc, os: windows-latest }
- { target: i686-pc-windows-msvc, os: windows-latest }
Expand All @@ -98,12 +85,9 @@ jobs:
# avx512vl, but occasionally doesn't. Maybe one day we can enable it.

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup Rust
run: |
rustup update nightly --no-self-update
rustup default nightly
rustup target add ${{ matrix.target }}
run: rustup target add ${{ matrix.target }}

- name: Configure RUSTFLAGS
shell: bash
Expand Down Expand Up @@ -145,6 +129,35 @@ jobs:
run: cargo doc --verbose --target=${{ matrix.target }}
env:
RUSTDOCFLAGS: -Dwarnings

macos-tests:
name: ${{ matrix.target }}
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
target:
- aarch64-apple-darwin
- x86_64-apple-darwin
steps:
- uses: actions/checkout@v4
- name: Setup Rust
run: rustup target add ${{ matrix.target }}

- name: Configure RUSTFLAGS
shell: bash
run: echo "RUSTFLAGS=-Dwarnings" >> $GITHUB_ENV

- name: Test (debug)
run: cargo test --verbose --target=${{ matrix.target }}

- name: Test (release)
run: cargo test --verbose --target=${{ matrix.target }} --release

- name: Generate docs
run: cargo doc --verbose --target=${{ matrix.target }}
env:
RUSTDOCFLAGS: -Dwarnings

wasm-tests:
name: "wasm (firefox, ${{ matrix.name }})"
Expand All @@ -155,11 +168,7 @@ jobs:
- { name: default, RUSTFLAGS: "" }
- { name: simd128, RUSTFLAGS: "-C target-feature=+simd128" }
steps:
- uses: actions/checkout@v2
- name: Setup Rust
run: |
rustup update nightly --no-self-update
rustup default nightly
- uses: actions/checkout@v4
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Test (debug)
Expand All @@ -174,6 +183,8 @@ jobs:
cross-tests:
name: "${{ matrix.target_feature }} on ${{ matrix.target }} (via cross)"
runs-on: ubuntu-latest
env:
PROPTEST_CASES: 16
strategy:
fail-fast: false

Expand All @@ -185,6 +196,7 @@ jobs:
- powerpc-unknown-linux-gnu
- powerpc64le-unknown-linux-gnu # includes altivec by default
- riscv64gc-unknown-linux-gnu
- loongarch64-unknown-linux-gnu
# MIPS uses a nonstandard binary representation for NaNs which makes it worth testing
# non-nightly since https://github.com/rust-lang/rust/pull/113274
# - mips-unknown-linux-gnu
Expand All @@ -201,24 +213,14 @@ jobs:
# - { target: riscv64gc-unknown-linux-gnu, target_feature: "+v,+zvl128b" }

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup Rust
run: |
rustup update nightly --no-self-update
rustup default nightly
rustup target add ${{ matrix.target }}
rustup component add rust-src
run: rustup target add ${{ matrix.target }}

- name: Install Cross
# Equivalent to `cargo install cross`, but downloading a prebuilt
# binary. Ideally we wouldn't hardcode a version, but the version number
# being part of the tarball means we can't just use the download/latest
# URL :(
# Install the latest git version for newer targets.
run: |
CROSS_URL=https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-x86_64-unknown-linux-gnu.tar.gz
mkdir -p "$HOME/.bin"
curl -sfSL --retry-delay 10 --retry 5 "${CROSS_URL}" | tar zxf - -C "$HOME/.bin"
echo "$HOME/.bin" >> $GITHUB_PATH
cargo install cross --git https://github.com/cross-rs/cross --rev 4090beca3cfffa44371a5bba524de3a578aa46c3

- name: Configure Emulated CPUs
run: |
Expand All @@ -242,34 +244,11 @@ jobs:
- name: Test (release)
run: cross test --verbose --target=${{ matrix.target }} --release

features:
name: "Test cargo features (${{ matrix.simd }} × ${{ matrix.features }})"
miri:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
simd:
- ""
- "avx512"
features:
- ""
- "--features std"
- "--features all_lane_counts"
- "--all-features"

env:
PROPTEST_CASES: 16
steps:
- uses: actions/checkout@v2
- name: Setup Rust
run: |
rustup update nightly --no-self-update
rustup default nightly
- name: Detect AVX512
run: echo "CPU_FEATURE=$(lscpu | grep -o avx512[a-z]* | sed s/avx/+avx/ | tr '\n' ',' )" >> $GITHUB_ENV
- name: Check build
if: ${{ matrix.simd == '' }}
run: RUSTFLAGS="-Dwarnings" cargo test --all-targets --no-default-features ${{ matrix.features }}
- name: Check AVX
if: ${{ matrix.simd == 'avx512' && contains(env.CPU_FEATURE, 'avx512') }}
run: |
echo "Found AVX features: $CPU_FEATURE"
RUSTFLAGS="-Dwarnings -Ctarget-feature=$CPU_FEATURE" cargo test --all-targets --no-default-features ${{ matrix.features }}
- uses: actions/checkout@v4
- name: Test (Miri)
run: cargo miri test
2 changes: 1 addition & 1 deletion library/portable-simd/.github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

steps:
- name: Checkout Repository
uses: actions/checkout@v1
uses: actions/checkout@v4

- name: Setup Rust
run: |
Expand Down
1 change: 1 addition & 0 deletions library/portable-simd/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/target
git-subtree.sh
6 changes: 6 additions & 0 deletions library/portable-simd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ members = [
"crates/std_float",
"crates/test_helpers",
]

[profile.test.package."*"]
opt-level = 2

[profile.test.package.test_helpers]
opt-level = 2
2 changes: 2 additions & 0 deletions library/portable-simd/Cross.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build.env]
passthrough = ["PROPTEST_CASES"]
3 changes: 1 addition & 2 deletions library/portable-simd/crates/core_simd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ categories = ["hardware-support", "no-std"]
license = "MIT OR Apache-2.0"

[features]
default = ["as_crate"]
default = ["as_crate", "std"]
as_crate = []
std = []
all_lane_counts = []

[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen = "0.2"
Expand Down
8 changes: 3 additions & 5 deletions library/portable-simd/crates/core_simd/src/lane_count.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ macro_rules! supported_lane_count {
};
}

supported_lane_count!(1, 2, 4, 8, 16, 32, 64);
#[cfg(feature = "all_lane_counts")]
supported_lane_count!(
3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64
);
4 changes: 2 additions & 2 deletions library/portable-simd/crates/core_simd/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![no_std]
#![feature(
const_refs_to_cell,
const_mut_refs,
const_eval_select,
convert_float_to_int,
core_intrinsics,
decl_macro,
Expand All @@ -26,6 +25,7 @@
all(target_arch = "arm", target_feature = "v7"),
feature(stdarch_arm_neon_intrinsics)
)]
#![cfg_attr(target_arch = "loongarch64", feature(stdarch_loongarch))]
#![cfg_attr(
any(target_arch = "powerpc", target_arch = "powerpc64"),
feature(stdarch_powerpc)
Expand Down
42 changes: 0 additions & 42 deletions library/portable-simd/crates/core_simd/src/masks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,48 +308,6 @@ where
Self(mask_impl::Mask::from_bitmask_integer(bitmask))
}

/// Creates a bitmask vector from a mask.
///
/// Each bit is set if the corresponding element in the mask is `true`.
/// The remaining bits are unset.
///
/// The bits are packed into the first N bits of the vector:
/// ```
/// # #![feature(portable_simd)]
/// # #[cfg(feature = "as_crate")] use core_simd::simd;
/// # #[cfg(not(feature = "as_crate"))] use core::simd;
/// # use simd::mask32x8;
/// let mask = mask32x8::from_array([true, false, true, false, false, false, true, false]);
/// assert_eq!(mask.to_bitmask_vector()[0], 0b01000101);
/// ```
#[inline]
#[must_use = "method returns a new integer and does not mutate the original value"]
pub fn to_bitmask_vector(self) -> Simd<u8, N> {
self.0.to_bitmask_vector()
}

/// Creates a mask from a bitmask vector.
///
/// For each bit, if it is set, the corresponding element in the mask is set to `true`.
///
/// The bits are packed into the first N bits of the vector:
/// ```
/// # #![feature(portable_simd)]
/// # #[cfg(feature = "as_crate")] use core_simd::simd;
/// # #[cfg(not(feature = "as_crate"))] use core::simd;
/// # use simd::{mask32x8, u8x8};
/// let bitmask = u8x8::from_array([0b01000101, 0, 0, 0, 0, 0, 0, 0]);
/// assert_eq!(
/// mask32x8::from_bitmask_vector(bitmask),
/// mask32x8::from_array([true, false, true, false, false, false, true, false]),
/// );
/// ```
#[inline]
#[must_use = "method returns a new mask and does not mutate the original value"]
pub fn from_bitmask_vector(bitmask: Simd<u8, N>) -> Self {
Self(mask_impl::Mask::from_bitmask_vector(bitmask))
}

/// Finds the index of the first set element.
///
/// ```
Expand Down
17 changes: 0 additions & 17 deletions library/portable-simd/crates/core_simd/src/masks/bitmask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,23 +122,6 @@ where
unsafe { Self(core::intrinsics::simd::simd_bitmask(value), PhantomData) }
}

#[inline]
#[must_use = "method returns a new vector and does not mutate the original value"]
pub fn to_bitmask_vector(self) -> Simd<u8, N> {
let mut bitmask = Simd::splat(0);
bitmask.as_mut_array()[..self.0.as_ref().len()].copy_from_slice(self.0.as_ref());
bitmask
}

#[inline]
#[must_use = "method returns a new mask and does not mutate the original value"]
pub fn from_bitmask_vector(bitmask: Simd<u8, N>) -> Self {
let mut bytes = <LaneCount<N> as SupportedLaneCount>::BitMask::default();
let len = bytes.as_ref().len();
bytes.as_mut().copy_from_slice(&bitmask.as_array()[..len]);
Self(bytes, PhantomData)
}

#[inline]
pub fn to_bitmask_integer(self) -> u64 {
let mut bitmask = [0u8; 8];
Expand Down
Loading
Loading