Skip to content

Commit

Permalink
Revert non-power-of-two vector restriction
Browse files Browse the repository at this point in the history
  • Loading branch information
XAMPPRocky committed Mar 2, 2021
1 parent 4f20caa commit 79c5fa1
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 40 deletions.
5 changes: 0 additions & 5 deletions compiler/rustc_middle/src/ty/layout.rs
Expand Up @@ -732,11 +732,6 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
// 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 {}",
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/simd/issue-17170.rs
@@ -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);

Expand Down
11 changes: 0 additions & 11 deletions src/test/ui/simd/issue-17170.stderr

This file was deleted.

3 changes: 1 addition & 2 deletions src/test/ui/simd/issue-39720.rs
@@ -1,16 +1,15 @@
// run-pass
// ignore-emscripten FIXME(#45351)

#![feature(repr_simd, platform_intrinsics)]

#[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;
Expand Down
15 changes: 0 additions & 15 deletions src/test/ui/simd/issue-39720.stderr

This file was deleted.

6 changes: 0 additions & 6 deletions src/test/ui/simd/simd-type.stderr
Expand Up @@ -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
|
Expand Down

0 comments on commit 79c5fa1

Please sign in to comment.