summaryrefslogtreecommitdiffstats
path: root/tests/ui/simd/monomorphize-shuffle-index.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/ui/simd/monomorphize-shuffle-index.rs28
1 files changed, 23 insertions, 5 deletions
diff --git a/tests/ui/simd/monomorphize-shuffle-index.rs b/tests/ui/simd/monomorphize-shuffle-index.rs
index 2467baa08..db7953f06 100644
--- a/tests/ui/simd/monomorphize-shuffle-index.rs
+++ b/tests/ui/simd/monomorphize-shuffle-index.rs
@@ -1,8 +1,14 @@
-//run-pass
-#![feature(repr_simd, platform_intrinsics)]
+//[old]run-pass
+//[generic_with_fn]run-pass
+// revisions: old generic generic_with_fn
+#![feature(repr_simd, platform_intrinsics, adt_const_params, generic_const_exprs)]
+#![allow(incomplete_features)]
extern "platform-intrinsic" {
+ #[cfg(old)]
fn simd_shuffle<T, I, U>(a: T, b: T, i: I) -> U;
+ #[cfg(any(generic, generic_with_fn))]
+ fn simd_shuffle_generic<T, U, const I: &'static [u32]>(a: T, b: T) -> U;
}
#[derive(Copy, Clone)]
@@ -11,12 +17,24 @@ struct Simd<T, const N: usize>([T; N]);
trait Shuffle<const N: usize> {
const I: [u32; N];
-
- unsafe fn shuffle<T, const M: usize>(&self, a: Simd<T, M>, b: Simd<T, M>) -> Simd<T, N> {
- simd_shuffle(a, b, Self::I)
+ const J: &'static [u32] = &Self::I;
+
+ unsafe fn shuffle<T, const M: usize>(&self, a: Simd<T, M>, b: Simd<T, M>) -> Simd<T, N>
+ where
+ Thing<{ Self::J }>:,
+ {
+ #[cfg(old)]
+ return simd_shuffle(a, b, Self::I);
+ #[cfg(generic)]
+ return simd_shuffle_generic::<_, _, { &Self::I }>(a, b);
+ //[generic]~^ overly complex generic constant
+ #[cfg(generic_with_fn)]
+ return simd_shuffle_generic::<_, _, { Self::J }>(a, b);
}
}
+struct Thing<const X: &'static [u32]>;
+
fn main() {
struct I1;
impl Shuffle<4> for I1 {