Implement floating point SIMD intrinsics over all vector widths, and limit SIMD vector lengths.
This commit is contained in:
parent
fd85ca02f6
commit
07db2bfe39
10 changed files with 141 additions and 199 deletions
12
src/test/ui/simd-type-generic-monomorphisation-empty.rs
Normal file
12
src/test/ui/simd-type-generic-monomorphisation-empty.rs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// build-fail
|
||||
|
||||
#![feature(repr_simd, platform_intrinsics)]
|
||||
|
||||
// error-pattern:monomorphising SIMD type `Simd<0_usize>` of zero length
|
||||
|
||||
#[repr(simd)]
|
||||
struct Simd<const N: usize>([f32; N]);
|
||||
|
||||
fn main() {
|
||||
let _ = Simd::<0>([]);
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
error: monomorphising SIMD type `Simd<0_usize>` of zero length
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
12
src/test/ui/simd-type-generic-monomorphisation-oversized.rs
Normal file
12
src/test/ui/simd-type-generic-monomorphisation-oversized.rs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// build-fail
|
||||
|
||||
#![feature(repr_simd, platform_intrinsics)]
|
||||
|
||||
// error-pattern:monomorphising SIMD type `Simd<65537_usize>` of length greater than 65536
|
||||
|
||||
#[repr(simd)]
|
||||
struct Simd<const N: usize>([f32; N]);
|
||||
|
||||
fn main() {
|
||||
let _ = Simd::<65537>([0.; 65537]);
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
error: monomorphising SIMD type `Simd<65537_usize>` of length greater than 65536
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
@ -6,6 +6,9 @@
|
|||
#[repr(simd)]
|
||||
struct empty; //~ ERROR SIMD vector cannot be empty
|
||||
|
||||
#[repr(simd)]
|
||||
struct empty2([f32; 0]); //~ ERROR SIMD vector cannot be empty
|
||||
|
||||
#[repr(simd)]
|
||||
struct i64f64(i64, f64); //~ ERROR SIMD vector should be homogeneous
|
||||
|
||||
|
|
@ -17,4 +20,10 @@ struct FooV(Foo, Foo); //~ ERROR SIMD vector element type should be a primitive
|
|||
#[repr(simd)]
|
||||
struct FooV2([Foo; 2]); //~ ERROR SIMD vector element type should be a primitive scalar (integer/float/pointer) type
|
||||
|
||||
#[repr(simd)]
|
||||
struct TooBig([f32; 65537]); //~ ERROR SIMD vector cannot have more than 65536 elements
|
||||
|
||||
#[repr(simd)]
|
||||
struct JustRight([u128; 65536]);
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -4,25 +4,37 @@ error[E0075]: SIMD vector cannot be empty
|
|||
LL | struct empty;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error[E0076]: SIMD vector should be homogeneous
|
||||
error[E0075]: SIMD vector cannot be empty
|
||||
--> $DIR/simd-type.rs:10:1
|
||||
|
|
||||
LL | struct empty2([f32; 0]);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0076]: SIMD vector should be homogeneous
|
||||
--> $DIR/simd-type.rs:13:1
|
||||
|
|
||||
LL | struct i64f64(i64, f64);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ SIMD elements must have the same type
|
||||
|
||||
error[E0077]: SIMD vector element type should be a primitive scalar (integer/float/pointer) type
|
||||
--> $DIR/simd-type.rs:15:1
|
||||
--> $DIR/simd-type.rs:18:1
|
||||
|
|
||||
LL | struct FooV(Foo, Foo);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0077]: SIMD vector element type should be a primitive scalar (integer/float/pointer) type
|
||||
--> $DIR/simd-type.rs:18:1
|
||||
--> $DIR/simd-type.rs:21:1
|
||||
|
|
||||
LL | struct FooV2([Foo; 2]);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error[E0075]: SIMD vector cannot have more than 65536 elements
|
||||
--> $DIR/simd-type.rs:24:1
|
||||
|
|
||||
LL | struct TooBig([f32; 65537]);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
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…
Add table
Add a link
Reference in a new issue