Rollup merge of #137556 - RalfJung:simd_shuffle_const_generic, r=oli-obk
rename simd_shuffle_generic → simd_shuffle_const_generic I've been confused by this name one time too often. ;) r? `@oli-obk`
This commit is contained in:
commit
6c1f959288
10 changed files with 55 additions and 55 deletions
|
@ -116,8 +116,8 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
|
|||
});
|
||||
}
|
||||
|
||||
// simd_shuffle_generic<T, U, const I: &[u32]>(x: T, y: T) -> U
|
||||
sym::simd_shuffle_generic => {
|
||||
// simd_shuffle_const_generic<T, U, const I: &[u32]>(x: T, y: T) -> U
|
||||
sym::simd_shuffle_const_generic => {
|
||||
let [x, y] = args else {
|
||||
bug!("wrong number of args for intrinsic {intrinsic}");
|
||||
};
|
||||
|
|
|
@ -1329,7 +1329,7 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
|
|||
));
|
||||
}
|
||||
|
||||
if name == sym::simd_shuffle_generic {
|
||||
if name == sym::simd_shuffle_const_generic {
|
||||
let idx = fn_args[2].expect_const().to_value().valtree.unwrap_branch();
|
||||
let n = idx.len() as u64;
|
||||
|
||||
|
|
|
@ -699,7 +699,7 @@ pub fn check_intrinsic_type(
|
|||
| sym::simd_reduce_min
|
||||
| sym::simd_reduce_max => (2, 0, vec![param(0)], param(1)),
|
||||
sym::simd_shuffle => (3, 0, vec![param(0), param(0), param(1)], param(2)),
|
||||
sym::simd_shuffle_generic => (2, 1, vec![param(0), param(0)], param(1)),
|
||||
sym::simd_shuffle_const_generic => (2, 1, vec![param(0), param(0)], param(1)),
|
||||
|
||||
other => {
|
||||
tcx.dcx().emit_err(UnrecognizedIntrinsicFunction { span, name: other });
|
||||
|
|
|
@ -1915,7 +1915,7 @@ symbols! {
|
|||
simd_shl,
|
||||
simd_shr,
|
||||
simd_shuffle,
|
||||
simd_shuffle_generic,
|
||||
simd_shuffle_const_generic,
|
||||
simd_sub,
|
||||
simd_trunc,
|
||||
simd_with_exposed_provenance,
|
||||
|
|
|
@ -633,7 +633,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.write_immediate(*val, &dest)?;
|
||||
}
|
||||
}
|
||||
"shuffle_generic" => {
|
||||
"shuffle_const_generic" => {
|
||||
let [left, right] = check_arg_count(args)?;
|
||||
let (left, left_len) = this.project_to_simd(left)?;
|
||||
let (right, right_len) = this.project_to_simd(right)?;
|
||||
|
@ -657,7 +657,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
this.read_immediate(&this.project_index(&right, right_idx)?)?
|
||||
} else {
|
||||
throw_ub_format!(
|
||||
"`simd_shuffle_generic` index {src_index} is out-of-bounds for 2 vectors with length {dest_len}"
|
||||
"`simd_shuffle_const_generic` index {src_index} is out-of-bounds for 2 vectors with length {dest_len}"
|
||||
);
|
||||
};
|
||||
this.write_immediate(*val, &dest)?;
|
||||
|
|
|
@ -16,7 +16,7 @@ use std::simd::prelude::*;
|
|||
|
||||
#[rustc_intrinsic]
|
||||
#[rustc_nounwind]
|
||||
pub unsafe fn simd_shuffle_generic<T, U, const IDX: &'static [u32]>(_x: T, _y: T) -> U;
|
||||
pub unsafe fn simd_shuffle_const_generic<T, U, const IDX: &'static [u32]>(_x: T, _y: T) -> U;
|
||||
|
||||
fn simd_ops_f32() {
|
||||
let a = f32x4::splat(10.0);
|
||||
|
@ -619,13 +619,13 @@ fn simd_intrinsics() {
|
|||
simd_select(i8x4::from_array([0, -1, -1, 0]), b, a),
|
||||
i32x4::from_array([10, 2, 10, 10])
|
||||
);
|
||||
assert_eq!(simd_shuffle_generic::<_, i32x4, { &[3, 1, 0, 2] }>(a, b), a,);
|
||||
assert_eq!(simd_shuffle_const_generic::<_, i32x4, { &[3, 1, 0, 2] }>(a, b), a,);
|
||||
assert_eq!(
|
||||
simd_shuffle::<_, _, i32x4>(a, b, const { u32x4::from_array([3u32, 1, 0, 2]) }),
|
||||
a,
|
||||
);
|
||||
assert_eq!(
|
||||
simd_shuffle_generic::<_, i32x4, { &[7, 5, 4, 6] }>(a, b),
|
||||
simd_shuffle_const_generic::<_, i32x4, { &[7, 5, 4, 6] }>(a, b),
|
||||
i32x4::from_array([4, 2, 1, 10]),
|
||||
);
|
||||
assert_eq!(
|
||||
|
|
|
@ -41,7 +41,7 @@ unsafe fn simd_extract<T, E>(x: T, idx: u32) -> E;
|
|||
unsafe fn simd_shuffle<T, I, U>(x: T, y: T, idx: I) -> U;
|
||||
|
||||
#[rustc_intrinsic]
|
||||
unsafe fn simd_shuffle_generic<T, U, const IDX: &'static [u32]>(x: T, y: T) -> U;
|
||||
unsafe fn simd_shuffle_const_generic<T, U, const IDX: &'static [u32]>(x: T, y: T) -> U;
|
||||
|
||||
|
||||
#[repr(simd)]
|
||||
|
@ -83,27 +83,27 @@ fn main() {
|
|||
//~^ ERROR expected return type of length 8, found `i32x2` with length 2
|
||||
|
||||
const I2: &[u32] = &[0; 2];
|
||||
simd_shuffle_generic::<i32, i32, I2>(0, 0);
|
||||
simd_shuffle_const_generic::<i32, i32, I2>(0, 0);
|
||||
//~^ ERROR expected SIMD input type, found non-SIMD `i32`
|
||||
const I4: &[u32] = &[0; 4];
|
||||
simd_shuffle_generic::<i32, i32, I4>(0, 0);
|
||||
simd_shuffle_const_generic::<i32, i32, I4>(0, 0);
|
||||
//~^ ERROR expected SIMD input type, found non-SIMD `i32`
|
||||
const I8: &[u32] = &[0; 8];
|
||||
simd_shuffle_generic::<i32, i32, I8>(0, 0);
|
||||
simd_shuffle_const_generic::<i32, i32, I8>(0, 0);
|
||||
//~^ ERROR expected SIMD input type, found non-SIMD `i32`
|
||||
|
||||
simd_shuffle_generic::<_, f32x2, I2>(x, x);
|
||||
simd_shuffle_const_generic::<_, f32x2, I2>(x, x);
|
||||
//~^ ERROR element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32`
|
||||
simd_shuffle_generic::<_, f32x4, I4>(x, x);
|
||||
simd_shuffle_const_generic::<_, f32x4, I4>(x, x);
|
||||
//~^ ERROR element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32`
|
||||
simd_shuffle_generic::<_, f32x8, I8>(x, x);
|
||||
simd_shuffle_const_generic::<_, f32x8, I8>(x, x);
|
||||
//~^ ERROR element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32`
|
||||
|
||||
simd_shuffle_generic::<_, i32x8, I2>(x, x);
|
||||
simd_shuffle_const_generic::<_, i32x8, I2>(x, x);
|
||||
//~^ ERROR expected return type of length 2, found `i32x8` with length 8
|
||||
simd_shuffle_generic::<_, i32x8, I4>(x, x);
|
||||
simd_shuffle_const_generic::<_, i32x8, I4>(x, x);
|
||||
//~^ ERROR expected return type of length 4, found `i32x8` with length 8
|
||||
simd_shuffle_generic::<_, i32x2, I8>(x, x);
|
||||
simd_shuffle_const_generic::<_, i32x2, I8>(x, x);
|
||||
//~^ ERROR expected return type of length 8, found `i32x2` with length 2
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,59 +70,59 @@ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected ret
|
|||
LL | simd_shuffle::<_, _, i32x2>(x, x, IDX8);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected SIMD input type, found non-SIMD `i32`
|
||||
error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected SIMD input type, found non-SIMD `i32`
|
||||
--> $DIR/generic-elements.rs:86:9
|
||||
|
|
||||
LL | simd_shuffle_generic::<i32, i32, I2>(0, 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | simd_shuffle_const_generic::<i32, i32, I2>(0, 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected SIMD input type, found non-SIMD `i32`
|
||||
error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected SIMD input type, found non-SIMD `i32`
|
||||
--> $DIR/generic-elements.rs:89:9
|
||||
|
|
||||
LL | simd_shuffle_generic::<i32, i32, I4>(0, 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | simd_shuffle_const_generic::<i32, i32, I4>(0, 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected SIMD input type, found non-SIMD `i32`
|
||||
error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected SIMD input type, found non-SIMD `i32`
|
||||
--> $DIR/generic-elements.rs:92:9
|
||||
|
|
||||
LL | simd_shuffle_generic::<i32, i32, I8>(0, 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | simd_shuffle_const_generic::<i32, i32, I8>(0, 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32`
|
||||
error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32`
|
||||
--> $DIR/generic-elements.rs:95:9
|
||||
|
|
||||
LL | simd_shuffle_generic::<_, f32x2, I2>(x, x);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | simd_shuffle_const_generic::<_, f32x2, I2>(x, x);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32`
|
||||
error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32`
|
||||
--> $DIR/generic-elements.rs:97:9
|
||||
|
|
||||
LL | simd_shuffle_generic::<_, f32x4, I4>(x, x);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | simd_shuffle_const_generic::<_, f32x4, I4>(x, x);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32`
|
||||
error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32`
|
||||
--> $DIR/generic-elements.rs:99:9
|
||||
|
|
||||
LL | simd_shuffle_generic::<_, f32x8, I8>(x, x);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | simd_shuffle_const_generic::<_, f32x8, I8>(x, x);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return type of length 2, found `i32x8` with length 8
|
||||
error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected return type of length 2, found `i32x8` with length 8
|
||||
--> $DIR/generic-elements.rs:102:9
|
||||
|
|
||||
LL | simd_shuffle_generic::<_, i32x8, I2>(x, x);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | simd_shuffle_const_generic::<_, i32x8, I2>(x, x);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return type of length 4, found `i32x8` with length 8
|
||||
error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected return type of length 4, found `i32x8` with length 8
|
||||
--> $DIR/generic-elements.rs:104:9
|
||||
|
|
||||
LL | simd_shuffle_generic::<_, i32x8, I4>(x, x);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | simd_shuffle_const_generic::<_, i32x8, I4>(x, x);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0511]: invalid monomorphization of `simd_shuffle_generic` intrinsic: expected return type of length 8, found `i32x2` with length 2
|
||||
error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected return type of length 8, found `i32x2` with length 2
|
||||
--> $DIR/generic-elements.rs:106:9
|
||||
|
|
||||
LL | simd_shuffle_generic::<_, i32x2, I8>(x, x);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | simd_shuffle_const_generic::<_, i32x2, I8>(x, x);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 21 previous errors
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
error: overly complex generic constant
|
||||
--> $DIR/monomorphize-shuffle-index.rs:32:45
|
||||
--> $DIR/monomorphize-shuffle-index.rs:32:51
|
||||
|
|
||||
LL | return simd_shuffle_generic::<_, _, { &Self::I.0 }>(a, b);
|
||||
| ^^----------^^
|
||||
| |
|
||||
| pointer casts are not allowed in generic constants
|
||||
LL | return simd_shuffle_const_generic::<_, _, { &Self::I.0 }>(a, b);
|
||||
| ^^----------^^
|
||||
| |
|
||||
| pointer casts are not allowed in generic constants
|
||||
|
|
||||
= help: consider moving this anonymous constant into a `const` function
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ unsafe fn simd_shuffle<T, I, U>(a: T, b: T, i: I) -> U;
|
|||
|
||||
#[rustc_intrinsic]
|
||||
#[cfg(any(generic, generic_with_fn))]
|
||||
unsafe fn simd_shuffle_generic<T, U, const I: &'static [u32]>(a: T, b: T) -> U;
|
||||
unsafe fn simd_shuffle_const_generic<T, U, const I: &'static [u32]>(a: T, b: T) -> U;
|
||||
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
|
@ -29,10 +29,10 @@ trait Shuffle<const N: usize> {
|
|||
#[cfg(old)]
|
||||
return simd_shuffle(a, b, Self::I);
|
||||
#[cfg(generic)]
|
||||
return simd_shuffle_generic::<_, _, { &Self::I.0 }>(a, b);
|
||||
return simd_shuffle_const_generic::<_, _, { &Self::I.0 }>(a, b);
|
||||
//[generic]~^ overly complex generic constant
|
||||
#[cfg(generic_with_fn)]
|
||||
return simd_shuffle_generic::<_, _, { Self::J }>(a, b);
|
||||
return simd_shuffle_const_generic::<_, _, { Self::J }>(a, b);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue