Skip to content

Commit

Permalink
simd_shuffle: pass the idx argument as a vector
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Aug 28, 2024
1 parent 5dfe757 commit 024c72a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crates/core_arch/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,18 @@ macro_rules! types {
)*);
}

#[allow(unused)]
#[repr(simd)]
pub(crate) struct SimdShuffleIdx<const LEN: usize>(pub(crate) [u32; LEN]);

#[allow(unused)]
macro_rules! simd_shuffle {
($x:expr, $y:expr, $idx:expr $(,)?) => {{
$crate::intrinsics::simd::simd_shuffle::<_, [u32; _], _>($x, $y, const { $idx })
$crate::intrinsics::simd::simd_shuffle(
$x,
$y,
const { $crate::core_arch::macros::SimdShuffleIdx($idx) },
)
}};
}

Expand Down

0 comments on commit 024c72a

Please sign in to comment.