Skip to content

Commit 79c5fa1

Browse files
committed
Revert non-power-of-two vector restriction
1 parent 4f20caa commit 79c5fa1

File tree

6 files changed

+2
-40
lines changed

6 files changed

+2
-40
lines changed

compiler/rustc_middle/src/ty/layout.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -732,11 +732,6 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
732732
// Can't be caught in typeck if the array length is generic.
733733
if e_len == 0 {
734734
tcx.sess.fatal(&format!("monomorphising SIMD type `{}` of zero length", ty));
735-
} else if !e_len.is_power_of_two() {
736-
tcx.sess.fatal(&format!(
737-
"monomorphising SIMD type `{}` of non-power-of-two length",
738-
ty
739-
));
740735
} else if e_len > MAX_SIMD_LANES {
741736
tcx.sess.fatal(&format!(
742737
"monomorphising SIMD type `{}` of length greater than {}",

src/test/ui/simd/issue-17170.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
// run-pass
12
#![feature(repr_simd)]
23

34
#[repr(simd)]
45
struct T(f64, f64, f64);
5-
//~^ ERROR SIMD vector length must be a power of two
66

77
static X: T = T(0.0, 0.0, 0.0);
88

src/test/ui/simd/issue-17170.stderr

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/test/ui/simd/issue-39720.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1+
// run-pass
12
// ignore-emscripten FIXME(#45351)
23

34
#![feature(repr_simd, platform_intrinsics)]
45

56
#[repr(simd)]
67
#[derive(Copy, Clone, Debug)]
78
pub struct Char3(pub i8, pub i8, pub i8);
8-
//~^ ERROR SIMD vector length must be a power of two
99

1010
#[repr(simd)]
1111
#[derive(Copy, Clone, Debug)]
1212
pub struct Short3(pub i16, pub i16, pub i16);
13-
//~^ ERROR SIMD vector length must be a power of two
1413

1514
extern "platform-intrinsic" {
1615
fn simd_cast<T, U>(x: T) -> U;

src/test/ui/simd/issue-39720.stderr

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/test/ui/simd/simd-type.stderr

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ error[E0075]: SIMD vector cannot be empty
1010
LL | struct empty2([f32; 0]);
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^
1212

13-
error[E0075]: SIMD vector length must be a power of two
14-
--> $DIR/simd-type.rs:13:1
15-
|
16-
LL | struct pow2([f32; 7]);
17-
| ^^^^^^^^^^^^^^^^^^^^^^
18-
1913
error[E0076]: SIMD vector should be homogeneous
2014
--> $DIR/simd-type.rs:16:1
2115
|

0 commit comments

Comments
 (0)