Rollup merge of #82695 - XAMPPRocky:remove-non-power-of-two-limit, r=nagisa
Revert non-power-of-two vector restriction Removes the power of two restriction from rustc. As discussed in https://github.com/rust-lang/stdsimd/issues/63 r? ```@calebzulawski``` cc ```@workingjubilee``` ```@thomcc```
This commit is contained in:
commit
64b76da4b6
@ -732,11 +732,6 @@ fn layout_raw_uncached(&self, ty: Ty<'tcx>) -> Result<&'tcx Layout, LayoutError<
|
||||
// Can't be caught in typeck if the array length is generic.
|
||||
if e_len == 0 {
|
||||
tcx.sess.fatal(&format!("monomorphising SIMD type `{}` of zero length", ty));
|
||||
} else if !e_len.is_power_of_two() {
|
||||
tcx.sess.fatal(&format!(
|
||||
"monomorphising SIMD type `{}` of non-power-of-two length",
|
||||
ty
|
||||
));
|
||||
} else if e_len > MAX_SIMD_LANES {
|
||||
tcx.sess.fatal(&format!(
|
||||
"monomorphising SIMD type `{}` of length greater than {}",
|
||||
|
@ -1161,15 +1161,6 @@ pub fn check_simd(tcx: TyCtxt<'_>, sp: Span, def_id: LocalDefId) {
|
||||
if len == 0 {
|
||||
struct_span_err!(tcx.sess, sp, E0075, "SIMD vector cannot be empty").emit();
|
||||
return;
|
||||
} else if !len.is_power_of_two() {
|
||||
struct_span_err!(
|
||||
tcx.sess,
|
||||
sp,
|
||||
E0075,
|
||||
"SIMD vector length must be a power of two"
|
||||
)
|
||||
.emit();
|
||||
return;
|
||||
} else if len > MAX_SIMD_LANES {
|
||||
struct_span_err!(
|
||||
tcx.sess,
|
||||
|
@ -1,8 +1,8 @@
|
||||
// run-pass
|
||||
#![feature(repr_simd)]
|
||||
|
||||
#[repr(simd)]
|
||||
struct T(f64, f64, f64);
|
||||
//~^ ERROR SIMD vector length must be a power of two
|
||||
|
||||
static X: T = T(0.0, 0.0, 0.0);
|
||||
|
||||
|
@ -1,11 +0,0 @@
|
||||
error[E0075]: SIMD vector length must be a power of two
|
||||
--> $DIR/issue-17170.rs:4:1
|
||||
|
|
||||
LL | struct T(f64, f64, f64);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: monomorphising SIMD type `T` of non-power-of-two length
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0075`.
|
@ -1,3 +1,4 @@
|
||||
// run-pass
|
||||
// ignore-emscripten FIXME(#45351)
|
||||
|
||||
#![feature(repr_simd, platform_intrinsics)]
|
||||
@ -5,12 +6,10 @@
|
||||
#[repr(simd)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct Char3(pub i8, pub i8, pub i8);
|
||||
//~^ ERROR SIMD vector length must be a power of two
|
||||
|
||||
#[repr(simd)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct Short3(pub i16, pub i16, pub i16);
|
||||
//~^ ERROR SIMD vector length must be a power of two
|
||||
|
||||
extern "platform-intrinsic" {
|
||||
fn simd_cast<T, U>(x: T) -> U;
|
||||
|
@ -1,15 +0,0 @@
|
||||
error[E0075]: SIMD vector length must be a power of two
|
||||
--> $DIR/issue-39720.rs:7:1
|
||||
|
|
||||
LL | pub struct Char3(pub i8, pub i8, pub i8);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0075]: SIMD vector length must be a power of two
|
||||
--> $DIR/issue-39720.rs:12:1
|
||||
|
|
||||
LL | pub struct Short3(pub i16, pub i16, pub i16);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0075`.
|
@ -1,9 +1,7 @@
|
||||
// build-fail
|
||||
// run-pass
|
||||
|
||||
#![feature(repr_simd, platform_intrinsics)]
|
||||
|
||||
// error-pattern:monomorphising SIMD type `Simd<3_usize>` of non-power-of-two length
|
||||
|
||||
#[repr(simd)]
|
||||
struct Simd<const N: usize>([f32; N]);
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
error: monomorphising SIMD type `Simd<3_usize>` of non-power-of-two length
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -10,7 +10,7 @@
|
||||
struct empty2([f32; 0]); //~ ERROR SIMD vector cannot be empty
|
||||
|
||||
#[repr(simd)]
|
||||
struct pow2([f32; 7]); //~ ERROR SIMD vector length must be a power of two
|
||||
struct pow2([f32; 7]);
|
||||
|
||||
#[repr(simd)]
|
||||
struct i64f64(i64, f64); //~ ERROR SIMD vector should be homogeneous
|
||||
|
@ -10,12 +10,6 @@ error[E0075]: SIMD vector cannot be empty
|
||||
LL | struct empty2([f32; 0]);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0075]: SIMD vector length must be a power of two
|
||||
--> $DIR/simd-type.rs:13:1
|
||||
|
|
||||
LL | struct pow2([f32; 7]);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0076]: SIMD vector should be homogeneous
|
||||
--> $DIR/simd-type.rs:16:1
|
||||
|
|
||||
@ -40,7 +34,7 @@ error[E0075]: SIMD vector cannot have more than 32768 elements
|
||||
LL | struct TooBig([f32; 65536]);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0075, E0076, E0077.
|
||||
For more information about an error, try `rustc --explain E0075`.
|
||||
|
Loading…
Reference in New Issue
Block a user