Skip to content

Commit

Permalink
Stop using old-style simd_shuffle (rust-lang/packed-simd#350)
Browse files Browse the repository at this point in the history
Stop using old-style `simd_shuffle`.
This prevents some possible future ICEs from internal compiler changes.
  • Loading branch information
workingjubilee committed Jul 28, 2023
2 parents 2ffcc96 + c6a25c5 commit 8b5a04f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/run-ci-script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,10 @@ jobs:
~/.rustup/toolchains
key: ${{ runner.os }}-cargo-${{ hashFiles('**/rust-toolchain') }}
- name: Install Toolchain
uses: dtolnay/rust-toolchain@master
uses: dtolnay/rust-toolchain@nightly
with:
# FIXME: change to nightly once https://github.com/rust-lang/packed_simd/pull/350 is merged
# needs to be kept in sync with the toolchain files
toolchain: nightly-2023-06-14
targets: ${{ inputs.target }}
components: rustfmt
- name: Generate Lockfile
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2023-06-14
nightly
20 changes: 7 additions & 13 deletions src/codegen/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,8 @@ use crate::sealed::Shuffle;
#[allow(unused_imports)] // FIXME: spurious warning?
use crate::sealed::Simd;

// Shuffle intrinsics: expanded in users' crates, therefore public.
extern "platform-intrinsic" {
pub fn simd_shuffle2<T, U>(x: T, y: T, idx: [u32; 2]) -> U;
pub fn simd_shuffle4<T, U>(x: T, y: T, idx: [u32; 4]) -> U;
pub fn simd_shuffle8<T, U>(x: T, y: T, idx: [u32; 8]) -> U;
pub fn simd_shuffle16<T, U>(x: T, y: T, idx: [u32; 16]) -> U;
pub fn simd_shuffle32<T, U>(x: T, y: T, idx: [u32; 32]) -> U;
pub fn simd_shuffle64<T, U>(x: T, y: T, idx: [u32; 64]) -> U;
fn simd_shuffle<T, I, U>(x: T, y: T, idx: I) -> U;
}

#[allow(clippy::missing_safety_doc)]
Expand All @@ -22,7 +16,7 @@ where
T: Simd,
<T as Simd>::Element: Shuffle<[u32; 2], Output = U>,
{
simd_shuffle2(x, y, IDX)
simd_shuffle(x, y, IDX)
}

#[allow(clippy::missing_safety_doc)]
Expand All @@ -32,7 +26,7 @@ where
T: Simd,
<T as Simd>::Element: Shuffle<[u32; 4], Output = U>,
{
simd_shuffle4(x, y, IDX)
simd_shuffle(x, y, IDX)
}

#[allow(clippy::missing_safety_doc)]
Expand All @@ -42,7 +36,7 @@ where
T: Simd,
<T as Simd>::Element: Shuffle<[u32; 8], Output = U>,
{
simd_shuffle8(x, y, IDX)
simd_shuffle(x, y, IDX)
}

#[allow(clippy::missing_safety_doc)]
Expand All @@ -52,7 +46,7 @@ where
T: Simd,
<T as Simd>::Element: Shuffle<[u32; 16], Output = U>,
{
simd_shuffle16(x, y, IDX)
simd_shuffle(x, y, IDX)
}

#[allow(clippy::missing_safety_doc)]
Expand All @@ -62,7 +56,7 @@ where
T: Simd,
<T as Simd>::Element: Shuffle<[u32; 32], Output = U>,
{
simd_shuffle32(x, y, IDX)
simd_shuffle(x, y, IDX)
}

#[allow(clippy::missing_safety_doc)]
Expand All @@ -72,7 +66,7 @@ where
T: Simd,
<T as Simd>::Element: Shuffle<[u32; 64], Output = U>,
{
simd_shuffle64(x, y, IDX)
simd_shuffle(x, y, IDX)
}

extern "platform-intrinsic" {
Expand Down

0 comments on commit 8b5a04f

Please sign in to comment.